1
0
mirror of https://github.com/badges/shields.git synced 2025-04-18 19:44:04 +03:00
shields/services/github/github-directory-file-count.tester.js
Jonah Lawrence e7aecb1a3b
Use GraphQL to fix GitHub file count badges [github] (#8112)
* fix: Use graphQL for github file count badges

* Add test for repo not found and update transform tests

* Fix extensions in transform test

* Mark type and extension as required

* Simpler type transform since only file, dir supported
2022-06-22 18:57:56 +01:00

37 lines
945 B
JavaScript

import { isMetric } from '../test-validators.js'
import { createServiceTester } from '../tester.js'
export const t = await createServiceTester()
t.create('directory file count').get('/badges/shields.json').expectBadge({
label: 'files',
message: isMetric,
})
t.create('directory file count (custom path)')
.get('/badges/shields/services.json')
.expectBadge({
label: 'files',
message: isMetric,
})
t.create('directory file count (repo not found)')
.get('/badges/not_existing_repository.json')
.expectBadge({
label: 'files',
message: 'repo not found',
})
t.create('directory file count (directory not found)')
.get('/badges/shields/not_existing_directory.json')
.expectBadge({
label: 'files',
message: 'directory not found',
})
t.create('directory file count (not a directory)')
.get('/badges/shields/package.json.json')
.expectBadge({
label: 'files',
message: 'not a directory',
})