forked from badges/shields
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdockbit.js
44 lines (37 loc) · 1.17 KB
/
dockbit.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
'use strict';
const Joi = require('joi');
const ServiceTester = require('./runner/service-tester');
const t = new ServiceTester({ id: 'dockbit', title: 'Dockbit' });
module.exports = t;
t.create('deploy status')
.get('/DockbitStatus/health.json?token=TvavttxFHJ4qhnKstDxrvBXM')
.expectJSONTypes(Joi.object().keys({
name: 'deploy',
value: Joi.equal(
'success',
'failure',
'error',
'working',
'pending',
'rejected'
)
}));
t.create('unknown pipeline')
.get('/DockbitStatus/unknown.json')
.expectJSON({ name: 'deploy', value: 'not found' });
t.create('no deploy status')
.get('/foo/bar.json?token=123')
.intercept(nock => nock('https://dockbit.com/')
.get('/foo/bar/status/123')
.reply(200, {state: null}))
.expectJSON({ name: 'deploy', value: 'not found' });
t.create('server error')
.get('/foo/bar.json?token=123')
.intercept(nock => nock('https://dockbit.com/')
.get('/foo/bar/status/123')
.reply(500, 'Something went wrong'))
.expectJSON({ name: 'deploy', value: 'inaccessible' });
t.create('connection error')
.get('/foo/bar.json')
.networkOff()
.expectJSON({ name: 'deploy', value: 'inaccessible' });