-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathtestSetup.integration.ts
More file actions
32 lines (26 loc) · 952 Bytes
/
testSetup.integration.ts
File metadata and controls
32 lines (26 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { disconnectDatabases, truncateDatabases } from "./testUtilIntegration";
import chalk from "chalk";
if (!process.env.MAILING_INTEGRATION_TEST) {
throw new Error(
chalk.red(
"Refusing to run outside of CI mode! WARNING: running the integration tests against your development server will cause test data to be inserted into your development database. To run these tests locally, use `yarn ci:test:integration` instead."
)
);
}
if (
!process.env.MAILING_DATABASE_URL?.match(/test$/) ||
!process.env.WEB_DATABASE_URL?.match(/test$/)
)
throw new Error(
`refusing to run against non-test databases process.env.MAILING_DATABASE_URL: ${process.env.MAILING_DATABASE_URL} process.env.WEB_DATABASE_URL: ${process.env.WEB_DATABASE_URL}`
);
beforeAll(async () => {
await truncateDatabases();
});
afterAll(async () => {
await disconnectDatabases();
});
afterEach(() => {
jest.resetAllMocks();
});
export default {};