* Modify github-size.service.js * Add tests for Github Size Service to test the new ref parameter * Modified request for a file size: ref is now sent only if if was specified
32 lines
1.3 KiB
JavaScript
32 lines
1.3 KiB
JavaScript
import { isFileSize } from '../test-validators.js'
|
|
import { createServiceTester } from '../tester.js'
|
|
export const t = await createServiceTester()
|
|
|
|
t.create('File size')
|
|
.get('/webcaetano/craft/build/phaser-craft.min.js.json')
|
|
.expectBadge({ label: 'size', message: isFileSize })
|
|
|
|
t.create('File size 404')
|
|
.get('/webcaetano/craft/build/does-not-exist.min.js.json')
|
|
.expectBadge({ label: 'size', message: 'repo or file not found' })
|
|
|
|
t.create('File size for nonexisting branch')
|
|
.get('/webcaetano/craft/build/phaser-craft.min.js.json?branch=notARealBranch')
|
|
.expectBadge({ label: 'size', message: 'repo, branch or file not found' })
|
|
|
|
t.create('File size for "not a regular file"')
|
|
.get('/webcaetano/craft/build.json')
|
|
.expectBadge({ label: 'size', message: 'not a regular file' })
|
|
|
|
t.create('File size for a specified branch')
|
|
.get('/webcaetano/craft/build/craft.min.js.json?branch=version-2')
|
|
.expectBadge({ label: 'size', message: isFileSize })
|
|
|
|
t.create('File size for a specified tag')
|
|
.get('/webcaetano/craft/build/phaser-craft.min.js.json?branch=2.1.2')
|
|
.expectBadge({ label: 'size', message: isFileSize })
|
|
|
|
t.create('File size for a specified commit')
|
|
.get('/webcaetano/craft/build/phaser-craft.min.js.json?branch=b848dbb')
|
|
.expectBadge({ label: 'size', message: isFileSize })
|