How to use the @tsed/testing.TestContext.bootstrap 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 / test / units / testing / TestContext.spec.ts View on Github external
describe("bootstrap()", () => {
    beforeEach(TestContext.bootstrap(FakeServer as any));
    afterEach(TestContext.reset);

    it("should attach injector instance to TestContext", () => {
      expect(TestContext.injector).to.be.instanceof(InjectorService);
    });

    it("should replace FakeServer.startServers by a stub()", () => {
      expect(FakeServer.current.startServers).to.be.a("Function");
      expect(FakeServer.current.startServers()).to.be.an.instanceOf(Promise);
    });
  });
});
github TypedProject / ts-express-decorators / test / integration / rest.spec.ts View on Github external
describe("Rest", () => {
  let request: SuperTest.SuperTest;
  before(TestContext.bootstrap(FakeServer));
  before(
    inject([ExpressApplication], (expressApplication: ExpressApplication) => {
      request = SuperTest(expressApplication);
    })
  );
  after(TestContext.reset);
  describe("integration", () => {
    describe("GET /rest", () => {
      it("should return html content", done => {
        request
          .get("/rest/html")
          .expect(200)
          .end((err: any, response: any) => {
            if (err) {
              throw err;
            }
github TypedProject / ts-express-decorators / packages / testing-mongoose / src / TestMongooseContext.ts View on Github external
return async function before(): Promise {
      await TestMongooseContext.install(options.mongod);

      const before = TestContext.bootstrap(mod, {
        ...options,
        mongoose: await TestMongooseContext.getMongooseOptions()
      });

      await before();
    };
  }

@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