-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.js
55 lines (48 loc) · 1.38 KB
/
tests.js
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* eslint func-names:0, global-require: 0, import/no-extraneous-dependencies:0 */
module.exports = (hydra, describe, it) => {
const expect = require('chai').expect
const request = require('supertest')('http://localhost:5000')
describe('Hydra Cluster Dashboard', () => {
it('init', function (done) {
this.timeout(6000)
setTimeout(() => {
done()
}, 5000)
})
it('get all services', async () => {
await request
.get('/srvs')
.expect(200)
.then((response) => {
const srv = response.body.filter(e => e.serviceName === 'hydra-dashboard')[0]
expect(srv.available).to.equal(true)
})
})
it('get service routes', async () => {
await request
.get('/srvs/hydra-dashboard/routes')
.expect(200)
.then((response) => {
expect(response.body.includes('[GET]/srvs/:service/routes')).to.equal(true)
})
})
it('get service health', (done) => {
request
.get('/srvs/hydra-dashboard/health')
.expect(200)
.then((response) => {
expect(response.body.length > 0).to.equal(true)
done()
})
})
it('get nodes', (done) => {
request
.get('/nodes')
.expect(200)
.then((response) => {
expect(response.body.length > 0).to.equal(true)
done()
})
})
})
}