Migrated most service tests to use new expectBadge (#3122)

This commit is contained in:
Pierre-Yves B
2019-02-28 21:43:23 +00:00
committed by GitHub
parent 4e2d144f97
commit 1f29c22d3d
230 changed files with 3480 additions and 4439 deletions

View File

@@ -1,41 +1,32 @@
'use strict'
const Joi = require('joi')
const { withRegex } = require('../test-validators')
const t = (module.exports = require('../tester').createServiceTester())
t.create('existing bitcoin address')
.get('/skyplabs.json')
.expectJSONTypes(
Joi.object({
name: 'btc',
value: withRegex(/^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$/),
})
)
.expectBadge({
label: 'btc',
message: withRegex(/^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$/),
})
t.create('unknown username')
.get('/skyplabsssssss.json')
.expectJSONTypes(
Joi.object({
name: 'btc',
value: 'profile not found',
})
)
.expectBadge({
label: 'btc',
message: 'profile not found',
})
t.create('invalid username')
.get('/s.json')
.expectJSONTypes(
Joi.object({
name: 'btc',
value: 'invalid username',
})
)
.expectBadge({
label: 'btc',
message: 'invalid username',
})
t.create('missing bitcoin address')
.get('/test.json')
.expectJSONTypes(
Joi.object({
name: 'btc',
value: 'no bitcoin addresses found',
})
)
.expectBadge({
label: 'btc',
message: 'no bitcoin addresses found',
})

View File

@@ -5,38 +5,30 @@ const t = (module.exports = require('../tester').createServiceTester())
t.create('existing key fingerprint')
.get('/skyplabs.json')
.expectJSONTypes(
Joi.object({
name: 'pgp',
value: Joi.string()
.hex()
.length(16),
})
)
.expectBadge({
label: 'pgp',
message: Joi.string()
.hex()
.length(16),
})
t.create('unknown username')
.get('/skyplabsssssss.json')
.expectJSONTypes(
Joi.object({
name: 'pgp',
value: 'profile not found',
})
)
.expectBadge({
label: 'pgp',
message: 'profile not found',
})
t.create('invalid username')
.get('/s.json')
.expectJSONTypes(
Joi.object({
name: 'pgp',
value: 'invalid username',
})
)
.expectBadge({
label: 'pgp',
message: 'invalid username',
})
t.create('missing key fingerprint')
.get('/skyp.json')
.expectJSONTypes(
Joi.object({
name: 'pgp',
value: 'no key fingerprint found',
})
)
.expectBadge({
label: 'pgp',
message: 'no key fingerprint found',
})

View File

@@ -1,41 +1,32 @@
'use strict'
const Joi = require('joi')
const { withRegex } = require('../test-validators')
const t = (module.exports = require('../tester').createServiceTester())
t.create('existing stellar address')
.get('/skyplabs.json')
.expectJSONTypes(
Joi.object({
name: 'xlm',
value: withRegex(/^(?!not found$)/),
})
)
.expectBadge({
label: 'xlm',
message: withRegex(/^(?!not found$)/),
})
t.create('unknown username')
.get('/skyplabsssssss.json')
.expectJSONTypes(
Joi.object({
name: 'xlm',
value: 'profile not found',
})
)
.expectBadge({
label: 'xlm',
message: 'profile not found',
})
t.create('invalid username')
.get('/s.json')
.expectJSONTypes(
Joi.object({
name: 'xlm',
value: 'invalid username',
})
)
.expectBadge({
label: 'xlm',
message: 'invalid username',
})
t.create('missing stellar address')
.get('/test.json')
.expectJSONTypes(
Joi.object({
name: 'xlm',
value: 'no stellar address found',
})
)
.expectBadge({
label: 'xlm',
message: 'no stellar address found',
})

View File

@@ -1,41 +1,32 @@
'use strict'
const Joi = require('joi')
const { withRegex } = require('../test-validators')
const t = (module.exports = require('../tester').createServiceTester())
t.create('existing zcash address')
.get('/skyplabs.json')
.expectJSONTypes(
Joi.object({
name: 'zec',
value: withRegex(/^(?!not found$)/),
})
)
.expectBadge({
label: 'zec',
message: withRegex(/^(?!not found$)/),
})
t.create('unknown username')
.get('/skyplabsssssss.json')
.expectJSONTypes(
Joi.object({
name: 'zec',
value: 'profile not found',
})
)
.expectBadge({
label: 'zec',
message: 'profile not found',
})
t.create('invalid username')
.get('/s.json')
.expectJSONTypes(
Joi.object({
name: 'zec',
value: 'invalid username',
})
)
.expectBadge({
label: 'zec',
message: 'invalid username',
})
t.create('missing zcash address')
.get('/test.json')
.expectJSONTypes(
Joi.object({
name: 'zec',
value: 'no zcash addresses found',
})
)
.expectBadge({
label: 'zec',
message: 'no zcash addresses found',
})