Skip to content

Commit f518ecb

Browse files
author
hirsch88
committed
Refactoring e2e testing
1 parent 7b70468 commit f518ecb

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

test/e2e/api/info.test.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,29 @@ import { Application } from 'express';
22
import * as request from 'supertest';
33
import { bootstrapApp, BootstrapSettings } from '../utils/bootstrap';
44
import { env } from '../../../src/core/env';
5-
import { synchronizeDatabase } from '../../integration/utils/database';
5+
import { synchronizeDatabase, closeDatabase } from '../../integration/utils/database';
6+
67

78
describe('/api', () => {
89

10+
// -------------------------------------------------------------------------
11+
// Tear up
12+
// -------------------------------------------------------------------------
13+
914
let settings: BootstrapSettings;
1015
beforeAll(async () => settings = await bootstrapApp());
1116
beforeAll(async () => synchronizeDatabase(settings.connection));
1217

18+
// -------------------------------------------------------------------------
19+
// Tear down
20+
// -------------------------------------------------------------------------
21+
22+
afterAll(async () => closeDatabase(settings.connection));
23+
24+
// -------------------------------------------------------------------------
25+
// Test cases
26+
// -------------------------------------------------------------------------
27+
1328
test('GET: / should return the api-version', async (done) => {
1429
const response = await request(settings.app)
1530
.get('/api')

test/e2e/api/users.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { env } from '../../../src/core/env';
1010
import { synchronizeDatabase, closeDatabase } from '../../integration/utils/database';
1111
import { fakeAuthenticationForUser } from '../utils/auth';
1212

13+
1314
describe('/api/users', () => {
1415

1516
// -------------------------------------------------------------------------

test/e2e/utils/bootstrap.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
import * as http from 'http';
42
import { bootstrapMicroframework, Microframework } from 'microframework';
53
import { Application } from 'express';
@@ -15,6 +13,7 @@ import { iocLoader } from './../../../src/loaders/iocLoader';
1513
import { graphqlLoader } from './../../../src/loaders/graphqlLoader';
1614
import { eventDispatchLoader } from './../../../src/loaders/eventDispatchLoader';
1715

16+
1817
export interface BootstrapSettings {
1918
app: Application;
2019
server: http.Server;

0 commit comments

Comments
 (0)