Files
shields/services/github/github-discussions-total.tester.js
Prafful Javare a094c8a373 Add GitHub discussions total badge [GithubTotalDiscussions] (#6472)
* use headers from options passed as argument in request method

* add github total discussions badge

* use nonNegativeInteger for total discussion count

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2021-05-11 07:54:58 +00:00

16 lines
536 B
JavaScript

'use strict'
const { withRegex } = require('../test-validators')
const t = (module.exports = require('../tester').createServiceTester())
t.create('GitHub Total Discussions (repo not found)')
.get('/not-a-user/not-a-repo.json')
.expectBadge({ label: 'discussions', message: 'repo not found' })
// example: 6000 total
const numberSpaceTotal = withRegex(/^\d+ total$/)
t.create('GitHub Total Discussions (repo having discussions)')
.get('/vercel/next.js.json')
.expectBadge({ label: 'discussions', message: numberSpaceTotal })