Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
});
});
});
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;
}
return async function before(): Promise {
await TestMongooseContext.install(options.mongod);
const before = TestContext.bootstrap(mod, {
...options,
mongoose: await TestMongooseContext.getMongooseOptions()
});
await before();
};
}