-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run database setup and teardown via suite
Manually calling the DB setup / teardown within a test was verbose, but more importantly it meant teardown wouldn't happen if a test failed. That's no good! By using Jest's suite functionality we ensure that setup and teardown both run for each test regardless of test outcome. Issue #43 Support integration tests
- Loading branch information
Showing
3 changed files
with
14 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,14 @@ | ||
import request from 'supertest'; | ||
import { app } from '../app'; | ||
import { | ||
prepareDatabaseForCurrentWorker, | ||
cleanupDatabaseForCurrentWorker, | ||
} from '../test/harnessFunctions'; | ||
|
||
const agent = request.agent(app); | ||
|
||
describe('/canonicalFields', () => { | ||
describe('/', () => { | ||
it('should return HTTP Status Code 200 OK', async () => { | ||
await prepareDatabaseForCurrentWorker(); | ||
await agent | ||
.get('/canonicalFields') | ||
.expect(200); | ||
await cleanupDatabaseForCurrentWorker(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters