test: Avoid creation of new server/app instance for each route test

This commit is contained in:
Tom Moor
2022-08-08 12:06:54 +02:00
parent b45e6c504f
commit 71c9fcf59b
22 changed files with 59 additions and 129 deletions

View File

@@ -1,15 +1,12 @@
import TestServer from "fetch-test-server";
import env from "@server/env";
import { IntegrationAuthentication, SearchQuery } from "@server/models";
import webService from "@server/services/web";
import { buildDocument, buildIntegration } from "@server/test/factories";
import { flushdb, seed } from "@server/test/support";
import { flushdb, seed, getTestServer } from "@server/test/support";
import * as Slack from "@server/utils/slack";
const app = webService();
const server = new TestServer(app.callback());
const server = getTestServer();
beforeEach(() => flushdb());
afterAll(() => server.close());
jest.mock("../../utils/slack", () => ({
post: jest.fn(),
}));