generated from BloomTech-Labs/template-be
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserver.spec.js
More file actions
25 lines (22 loc) · 828 Bytes
/
server.spec.js
File metadata and controls
25 lines (22 loc) · 828 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
const request = require('supertest');
const server = require('./server.js');
const db = require('./data/db-config.js');
describe('server is properly setup', () => {
it('shoul set the environment to testing ', () => {
expect(process.env.DB_ENV).toBe('testing');
});
describe('GET / is set up properly', () => {
it('should return 200', async () => {
const res = await request(server).get('/');
expect(res.status).toBe(200);
});
it('should return JSON type', async () => {
const res = await request(server).get('/');
expect(res.type).toBe('application/json');
});
it('should return json, then parse to object', async () => {
const res = await request(server).get('/');
expect(typeof JSON.parse(res.text)).toBe('object');
});
}); // end of GET Describe
});