mirror of
https://github.com/badges/shields.git
synced 2026-11-20 06:43:07 +03:00
* added both the service and tester for both the answered and unanswered variant of github discussion * Remove GitHub discussions services and their corresponding tests for answered, total, and unanswered discussions and consolidate them as one service with different path * Refactor GitHub Discussions service to support 'all' variant and update route patterns. Adjust tests to reflect new endpoint structure. * Remove deprecated OpenAPI route for GitHub Discussions and retain only the 'all' variant endpoint.
32 lines
1.0 KiB
JavaScript
32 lines
1.0 KiB
JavaScript
import { withRegex } from '../test-validators.js'
|
|
import { createServiceTester } from '../tester.js'
|
|
export const t = await createServiceTester()
|
|
|
|
t.create('GitHub Discussions (repo not found)')
|
|
.get('/not-a-user/not-a-repo.json')
|
|
.expectBadge({ label: 'discussions', message: 'repo not found' })
|
|
|
|
const numberSpaceTotal = withRegex(/^\d+ total$/)
|
|
|
|
t.create('GitHub Discussions (repo having discussions)')
|
|
.get('/vercel/next.js.json')
|
|
.expectBadge({ label: 'discussions', message: numberSpaceTotal })
|
|
|
|
t.create('GitHub Discussions all (repo having discussions)')
|
|
.get('/all/vercel/next.js.json')
|
|
.expectBadge({ label: 'discussions', message: numberSpaceTotal })
|
|
|
|
t.create('GitHub Answered Discussions (repo having discussions)')
|
|
.get('/answered/vercel/next.js.json')
|
|
.expectBadge({
|
|
label: 'discussions',
|
|
message: withRegex(/^\d+ answered$/),
|
|
})
|
|
|
|
t.create('GitHub Unanswered Discussions (repo having discussions)')
|
|
.get('/unanswered/vercel/next.js.json')
|
|
.expectBadge({
|
|
label: 'discussions',
|
|
message: withRegex(/^\d+ unanswered$/),
|
|
})
|