Files
shields/services/github/github-discussions.tester.js
T
Adewale OLAMIDE Adesoba 8c77ded896 [GitHubDiscussions] Add the variant badge of github discussion (answered/unanswered) (#11951)
* 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.
2026-07-11 06:58:22 +00:00

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$/),
})