Skip to content

Commit

Permalink
feat: Making Jest set & reset DB in testing iterations
Browse files Browse the repository at this point in the history
- Also relates to #17
- and will benefit #5
  • Loading branch information
G0maa committed Dec 23, 2022
1 parent fd82a86 commit d617705
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};
globalSetup: './src/tests/setup.ts',
globalTeardown: './src/tests/teardown.ts',
};
5 changes: 5 additions & 0 deletions src/tests/setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { initServer } from '../app';

export default async () => {
await initServer();
};
5 changes: 5 additions & 0 deletions src/tests/teardown.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { rollbackAllMigrations } from '../utils/db';

export default async () => {
await rollbackAllMigrations();
};

0 comments on commit d617705

Please sign in to comment.