forked from badges/shields
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiscord.js
More file actions
31 lines (25 loc) · 874 Bytes
/
discord.js
File metadata and controls
31 lines (25 loc) · 874 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
'use strict';
const Joi = require('joi');
const ServiceTester = require('./runner/service-tester');
const t = new ServiceTester({ id: 'discord', title: 'Discord' });
module.exports = t;
t.create('gets status for Reactiflux')
.get('/102860784329052160.json')
.expectJSONTypes(Joi.object().keys({
name: Joi.equal('chat'),
value: Joi.string().regex(/^[0-9]+ online$/),
}));
t.create('invalid server ID')
.get('/12345.json')
.expectJSON({ name: 'chat', value: 'invalid server' });
t.create('server error')
.get('/12345.json')
.intercept(nock => nock('https://discordapp.com/')
.get('/api/guilds/12345/widget.json')
.reply(500, 'Something broke')
)
.expectJSON({ name: 'chat', value: 'inaccessible' });
t.create('connection error')
.get('/102860784329052160.json')
.networkOff()
.expectJSON({ name: 'chat', value: 'inaccessible' });