Split [Conda] tests (#3711)
This commit is contained in:
committed by
Caleb Cartwright
parent
102db63d46
commit
9576ba8fc3
23
services/conda/conda-downloads.tester.js
Normal file
23
services/conda/conda-downloads.tester.js
Normal file
@@ -0,0 +1,23 @@
|
||||
'use strict'
|
||||
|
||||
const { isMetric } = require('../test-validators')
|
||||
const t = (module.exports = require('../tester').createServiceTester())
|
||||
|
||||
t.create('downloads')
|
||||
.get('/d/conda-forge/zlib.json')
|
||||
.expectBadge({
|
||||
label: 'conda|downloads',
|
||||
message: isMetric,
|
||||
})
|
||||
|
||||
t.create('downloads (skip prefix)')
|
||||
.get('/dn/conda-forge/zlib.json')
|
||||
.expectBadge({ label: 'downloads', message: isMetric })
|
||||
|
||||
t.create('unknown package')
|
||||
.get('/d/conda-forge/some-bogus-package-that-never-exists.json')
|
||||
.expectBadge({ label: 'conda', message: 'not found' })
|
||||
|
||||
t.create('unknown channel')
|
||||
.get('/d/some-bogus-channel-that-never-exists/zlib.json')
|
||||
.expectBadge({ label: 'conda', message: 'not found' })
|
||||
19
services/conda/conda-platform.tester.js
Normal file
19
services/conda/conda-platform.tester.js
Normal file
@@ -0,0 +1,19 @@
|
||||
'use strict'
|
||||
|
||||
const Joi = require('@hapi/joi')
|
||||
const isCondaPlatform = Joi.string().regex(/^\w+-[\w\d]+( \| \w+-[\w\d]+)*$/)
|
||||
const t = (module.exports = require('../tester').createServiceTester())
|
||||
|
||||
t.create('platform')
|
||||
.get('/p/conda-forge/zlib.json')
|
||||
.expectBadge({
|
||||
label: 'conda|platform',
|
||||
message: isCondaPlatform,
|
||||
})
|
||||
|
||||
t.create('platform (skip prefix)')
|
||||
.get('/pn/conda-forge/zlib.json')
|
||||
.expectBadge({
|
||||
label: 'platform',
|
||||
message: isCondaPlatform,
|
||||
})
|
||||
18
services/conda/conda-version.tester.js
Normal file
18
services/conda/conda-version.tester.js
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict'
|
||||
|
||||
const { isVPlusTripleDottedVersion } = require('../test-validators')
|
||||
const t = (module.exports = require('../tester').createServiceTester())
|
||||
|
||||
t.create('version')
|
||||
.get('/v/conda-forge/zlib.json')
|
||||
.expectBadge({
|
||||
label: 'conda|conda-forge',
|
||||
message: isVPlusTripleDottedVersion,
|
||||
})
|
||||
|
||||
t.create('version (skip prefix)')
|
||||
.get('/vn/conda-forge/zlib.json')
|
||||
.expectBadge({
|
||||
label: 'conda-forge',
|
||||
message: isVPlusTripleDottedVersion,
|
||||
})
|
||||
@@ -1,56 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
const Joi = require('@hapi/joi')
|
||||
const { ServiceTester } = require('../tester')
|
||||
const { isVPlusTripleDottedVersion, isMetric } = require('../test-validators')
|
||||
|
||||
const isCondaPlatform = Joi.string().regex(/^\w+-[\w\d]+( \| \w+-[\w\d]+)*$/)
|
||||
|
||||
const t = (module.exports = new ServiceTester({ id: 'conda', title: 'Conda' }))
|
||||
|
||||
t.create('version')
|
||||
.get('/v/conda-forge/zlib.json')
|
||||
.expectBadge({
|
||||
label: 'conda|conda-forge',
|
||||
message: isVPlusTripleDottedVersion,
|
||||
})
|
||||
|
||||
t.create('version (skip prefix)')
|
||||
.get('/vn/conda-forge/zlib.json')
|
||||
.expectBadge({
|
||||
label: 'conda-forge',
|
||||
message: isVPlusTripleDottedVersion,
|
||||
})
|
||||
|
||||
t.create('platform')
|
||||
.get('/p/conda-forge/zlib.json')
|
||||
.expectBadge({
|
||||
label: 'conda|platform',
|
||||
message: isCondaPlatform,
|
||||
})
|
||||
|
||||
t.create('platform (skip prefix)')
|
||||
.get('/pn/conda-forge/zlib.json')
|
||||
.expectBadge({
|
||||
label: 'platform',
|
||||
message: isCondaPlatform,
|
||||
})
|
||||
|
||||
t.create('downloads')
|
||||
.get('/d/conda-forge/zlib.json')
|
||||
.expectBadge({
|
||||
label: 'conda|downloads',
|
||||
message: isMetric,
|
||||
})
|
||||
|
||||
t.create('downloads (skip prefix)')
|
||||
.get('/dn/conda-forge/zlib.json')
|
||||
.expectBadge({ label: 'downloads', message: isMetric })
|
||||
|
||||
t.create('unknown package')
|
||||
.get('/d/conda-forge/some-bogus-package-that-never-exists.json')
|
||||
.expectBadge({ label: 'conda', message: 'not found' })
|
||||
|
||||
t.create('unknown channel')
|
||||
.get('/d/some-bogus-channel-that-never-exists/zlib.json')
|
||||
.expectBadge({ label: 'conda', message: 'not found' })
|
||||
Reference in New Issue
Block a user