tests: fix spigetdownloadsize service test (#7018)

This commit is contained in:
Caleb Cartwright
2021-09-14 17:30:14 -05:00
committed by GitHub
parent 13a53f123f
commit 721d0142ff
2 changed files with 7 additions and 5 deletions

View File

@@ -2,16 +2,16 @@ import { isFileSize } from '../test-validators.js'
import { createServiceTester } from '../tester.js'
export const t = await createServiceTester()
t.create('EssentialsX (id 9089)')
.get('/9089.json')
t.create('EssentialsX (hosted resource)')
.get('/771.json')
.expectBadge({ label: 'size', message: isFileSize })
t.create('Pet Master (id 15904)').get('/15904.json').expectBadge({
t.create('Pet Master (external resource)').get('/15904.json').expectBadge({
lavel: 'size',
message: 'resource hosted externally',
})
t.create('Invalid Resource (id 1)').get('/1.json').expectBadge({
t.create('Invalid Resource').get('/1.json').expectBadge({
label: 'size',
message: 'not found',
})

View File

@@ -93,7 +93,9 @@ const isPercentage = Joi.alternatives().try(
isDecimalPercentage
)
const isFileSize = withRegex(/^[0-9]*[.]?[0-9]+\s(B|kB|MB|GB|TB|PB|EB|ZB|YB)$/)
const isFileSize = withRegex(
/^[0-9]*[.]?[0-9]+\s(B|kB|KB|MB|GB|TB|PB|EB|ZB|YB)$/
)
const isFormattedDate = Joi.alternatives().try(
Joi.equal('today', 'yesterday'),