* feat(gitea): add forks, stars, issues and pr badges * doc(comment): update comments * fix(gitea): update based on feedback * refactor(fetch): refactor fetch to be more generic * refactor(fetch): remove unused function * use isMetric --------- Co-authored-by: chris48s <chris48s@users.noreply.github.com>
33 lines
888 B
JavaScript
33 lines
888 B
JavaScript
import { isMetric } from '../test-validators.js'
|
|
import { createServiceTester } from '../tester.js'
|
|
|
|
export const t = await createServiceTester()
|
|
|
|
t.create('Stars')
|
|
.get('/gitea/tea.json')
|
|
.expectBadge({
|
|
label: 'stars',
|
|
message: isMetric,
|
|
color: 'blue',
|
|
link: ['https://gitea.com/gitea/tea', 'https://gitea.com/gitea/tea/stars'],
|
|
})
|
|
|
|
t.create('Stars (self-managed)')
|
|
.get('/CanisHelix/shields-badge-test.json?gitea_url=https://codeberg.org')
|
|
.expectBadge({
|
|
label: 'stars',
|
|
message: isMetric,
|
|
color: 'blue',
|
|
link: [
|
|
'https://codeberg.org/CanisHelix/shields-badge-test',
|
|
'https://codeberg.org/CanisHelix/shields-badge-test/stars',
|
|
],
|
|
})
|
|
|
|
t.create('Stars (project not found)')
|
|
.get('/CanisHelix/does-not-exist.json?gitea_url=https://codeberg.org')
|
|
.expectBadge({
|
|
label: 'stars',
|
|
message: 'user or repo not found',
|
|
})
|