-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
21 lines (21 loc) · 856 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const request = require('supertest');
const app = require('../app')
describe('Test Status Codes', () => {
test('Heartbeat', async () => {
const resp = await request(app).get('/api/heartbeat');
expect(resp.statusCode).toBe(200);
expect(resp.text).toBe("BOO-BUM")
});
if (!global.__IS_REMOTE__) { // can only be tested locally
test('CouchPotato', async () => {
let resp = await request(app).get('/api/couch');
expect(resp.statusCode).toBe(400);
resp = await request(app).get('/api/couch?title=blah');
expect(resp.statusCode).toBe(200)
resp = await request(app).get('/api/couch/status')
expect(resp.statusCode).toBe(200)
resp = await request(app).post('/api/couch')
expect(resp.statusCode).toBe(400)
})
}
})