Merging this separately so the commit with the tooling change is readable. This is a follow-on to #1167 which turned prettier on.
46 lines
1.0 KiB
JavaScript
46 lines
1.0 KiB
JavaScript
'use strict'
|
|
|
|
const Joi = require('joi')
|
|
const ServiceTester = require('../service-tester')
|
|
|
|
const { isMetric } = require('../test-validators')
|
|
|
|
const t = new ServiceTester({ id: 'twitter', title: 'Twitter' })
|
|
module.exports = t
|
|
|
|
t.create('Followers')
|
|
.get('/follow/shields_io.json')
|
|
.expectJSONTypes(
|
|
Joi.object().keys({
|
|
name: 'Follow @shields_io',
|
|
value: isMetric,
|
|
})
|
|
)
|
|
|
|
t.create('Followers - Custom Label')
|
|
.get('/follow/shields_io.json?label=Follow')
|
|
.expectJSONTypes(
|
|
Joi.object().keys({
|
|
name: 'Follow',
|
|
value: isMetric,
|
|
})
|
|
)
|
|
|
|
t.create('Invalid Username Specified')
|
|
.get('/follow/invalidusernamethatshouldnotexist.json?label=Follow')
|
|
.expectJSONTypes(
|
|
Joi.object().keys({
|
|
name: 'Follow',
|
|
value: 'invalid user',
|
|
})
|
|
)
|
|
|
|
t.create('No connection')
|
|
.get('/follow/shields_io.json?label=Follow')
|
|
.networkOff()
|
|
.expectJSON({ name: 'Follow', value: 'inaccessible' })
|
|
|
|
t.create('URL')
|
|
.get('/url/https/shields.io.json')
|
|
.expectJSON({ name: 'tweet', value: '' })
|