How to use the @tsed/testing.TestContext.create function in @tsed/testing

To help you get started, we’ve selected a few @tsed/testing examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TypedProject / ts-express-decorators / packages / testing-mongoose / src / TestMongooseContext.ts View on Github external
static async create(options: Partial = {}) {
    await TestMongooseContext.install(options.mongod);

    options.mongoose = await TestMongooseContext.getMongooseOptions();

    return TestContext.create(options);
  }
github TypedProject / ts-express-decorators / test / units / socketio / services / SocketIOService.spec.ts View on Github external
before(async () => {
        await TestContext.create();
        this.socketIOServer = {attach: Sinon.stub(), adapter: Sinon.stub()};
        this.httpServer = {type: "http", get: Sinon.stub().returns("httpServer")};
        this.httpsServer = {type: "https", get: Sinon.stub().returns("httpsServer")};

        socketIOService = TestContext.invoke(SocketIOService, [
          {provide: HttpServer, use: this.httpServer},
          {provide: HttpsServer, use: this.httpsServer},
          {provide: SocketIOServer, use: this.socketIOServer}
        ]);

        this.getWebsocketServicesStub = Sinon.stub(socketIOService, "getWebsocketServices");
        this.bindProviderStub = Sinon.stub(socketIOService, "bindProvider");
        this.printSocketEventsStub = Sinon.stub(socketIOService, "printSocketEvents");

        this.getWebsocketServicesStub.returns([{provider: "provider"}]);

@tsed/testing

A TypeScript Framework on top of Express

MIT
Latest version published 4 years ago

Package Health Score

62 / 100
Full package analysis

Similar packages