forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServer.test.js
More file actions
32 lines (27 loc) · 940 Bytes
/
Server.test.js
File metadata and controls
32 lines (27 loc) · 940 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
26
27
28
29
30
31
32
import request from 'supertest'
import { Server } from '../Server'
describe('Server', () => {
it('does not include express headers', async () => {
const server = new Server()
const { headers } = await request(server).get('/')
expect(headers).not.toHaveProperty('x-powered-by')
})
describe('GET', () => {
describe('/alive', () => {
it('confirms the server is running', async () => {
const server = new Server()
const response = await request(server).get('/alive')
expect(response.status).toEqual(200)
expect(response.body).toEqual({ status: 'ok' })
})
})
describe('/ready', () => {
it('confirms the server is ready', async () => {
const server = new Server()
const response = await request(server).get('/ready')
expect(response.status).toEqual(200)
expect(response.body).toEqual({ status: 'ready' })
})
})
})
})