mirror of
https://github.com/badges/shields.git
synced 2025-07-08 18:01:59 +03:00
Port [StackExchange] from legacy to BaseJsonService (#2418)
Per part of issue #2378, convert StackExchange service to the newer BaseJson class. Refactor also to seperate StackExchange reputation and questions tag info into new StackExchange subservice files as the legacy class contained both which may be difficult to keep track of in the future as the service continues to grow. More tests have been added to make sure other StackExchange sites besides StackOverflow will still work with the new badge setup.
This commit is contained in:
committed by
Paul Melnikow
parent
43d99f96e6
commit
9713964812
28
services/stackexchange/stackexchange-reputation.tester.js
Normal file
28
services/stackexchange/stackexchange-reputation.tester.js
Normal file
@ -0,0 +1,28 @@
|
||||
'use strict'
|
||||
|
||||
const Joi = require('joi')
|
||||
const { isMetric } = require('../test-validators')
|
||||
const t = require('../create-service-tester')()
|
||||
module.exports = t
|
||||
|
||||
t.create('Invalid parameters')
|
||||
.get('/stackoverflow/invalidimage.json')
|
||||
.expectJSON({ name: 'stackoverflow', value: 'invalid parameters' })
|
||||
|
||||
t.create('Reputation for StackOverflow user 22656')
|
||||
.get('/stackoverflow/22656.json')
|
||||
.expectJSONTypes(
|
||||
Joi.object().keys({
|
||||
name: 'stackoverflow reputation',
|
||||
value: isMetric,
|
||||
})
|
||||
)
|
||||
|
||||
t.create('Reputation for Tex user 22656')
|
||||
.get('/tex/226.json')
|
||||
.expectJSONTypes(
|
||||
Joi.object().keys({
|
||||
name: 'tex reputation',
|
||||
value: isMetric,
|
||||
})
|
||||
)
|
Reference in New Issue
Block a user