本文整理汇总了TypeScript中@tsed/testing.TestContext.invoke方法的典型用法代码示例。如果您正苦于以下问题:TypeScript TestContext.invoke方法的具体用法?TypeScript TestContext.invoke怎么用?TypeScript TestContext.invoke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@tsed/testing.TestContext
的用法示例。
在下文中一共展示了TestContext.invoke方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it("should call attach method", inject([ServerSettingsService], async (serverSettingsService: ServerSettingsService) => {
// GIVEN
const socketIOServer = {attach: Sinon.stub(), adapter: Sinon.stub()};
const httpServer = {type: "http", get: Sinon.stub().returns("httpServer")};
const httpsServer = {type: "https", get: Sinon.stub().returns("httpsServer")};
const socketIOService = {addSocketProvider: Sinon.stub()};
serverSettingsService.set("socketIO", {config: "config"});
serverSettingsService.set("http", false);
const socketIOModule = TestContext.invoke(SocketIOModule, [
{provide: HttpServer, use: httpServer},
{provide: HttpsServer, use: httpsServer},
{provide: SocketIOServer, use: socketIOServer},
{provide: SocketIOService, use: socketIOService}
]);
this.getWebsocketServicesStub.returns([{provider: "provider"}]);
// WHEN
await socketIOModule.$onServerReady();
socketIOServer.attach.should.have.been.calledWithExactly(httpsServer, {
config: "config"
});
this.getWebsocketServicesStub.should.have.been.calledWithExactly();
socketIOService.addSocketProvider.should.have.been.calledWithExactly({provider: "provider"});
}));