Migrated most service tests to use new expectBadge (#3122)
This commit is contained in:
@@ -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',
|
||||
})
|
||||
|
||||
@@ -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',
|
||||
})
|
||||
|
||||
@@ -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',
|
||||
})
|
||||
|
||||
@@ -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',
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user