Skip to content

Commit 7a2ed8c

Browse files
author
Walker Leite
committed
test(index): refactor test to work with jest
1 parent 200b615 commit 7a2ed8c

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

template/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
"jest-plugins": "^2.9.0",
7070
"jest-preset-loopback": "^1.0.0",
7171
"loopback-jest": "^1.3.0",
72+
"supertest": "^3.1.0",
7273
"tfilter": "^1.0.1",
7374
"through2": "^2.0.3",
7475
"tmp": "0.0.33",

template/test/server/index.spec.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import server from '../../index';
2+
import request from 'supertest';
23

34
describe('Project Index', () => {
45
beforeEach((done) => {
@@ -8,11 +9,8 @@ describe('Project Index', () => {
89

910
afterEach(() => server.close());
1011

11-
it('should serve client files', (done) => {
12-
request(server).get('/index.html').end((err, res) => {
13-
expect(err).toEqual(null);
14-
expect(res).to.status(200);
15-
done();
16-
});
12+
it('should serve client files', async () => {
13+
const res = await request(server).get('/index.html');
14+
expect(res.statusCode).toBe(200);
1715
});
1816
});

0 commit comments

Comments
 (0)