fix [GitHubHacktoberfest] service test (#4299)
* tests: fix hacktoberfest service test * tests: update message for post-hacktoberfest, add couple unit tests * chore: lgtm fix * tests: fix unit test
This commit is contained in:
@@ -3,15 +3,27 @@
|
||||
const Joi = require('@hapi/joi')
|
||||
const t = (module.exports = require('../tester').createServiceTester())
|
||||
|
||||
const isHactoberfestCombinedStatus = Joi.string().regex(
|
||||
const isHacktoberfestNoIssuesStatus = Joi.string().regex(
|
||||
/^[0-9]+ PRs?(, [0-9]+ days? left)?$/
|
||||
)
|
||||
const isHacktoberfestNoPRsStatus = Joi.string().regex(
|
||||
/^([0-9]+ open issues?)?[0-9]+ days? left$/
|
||||
)
|
||||
const isHacktoberfestCombinedStatus = Joi.string().regex(
|
||||
/^[0-9]+ open issues?(, [0-9]+ PRs?)?(, [0-9]+ days? left)?$/
|
||||
)
|
||||
const isHacktoberfestStatus = Joi.alternatives().try(
|
||||
isHacktoberfestNoIssuesStatus,
|
||||
isHacktoberfestNoPRsStatus,
|
||||
isHacktoberfestCombinedStatus,
|
||||
/^is over! \([0-9]+ PRs? opened\)$/
|
||||
)
|
||||
|
||||
t.create('GitHub Hacktoberfest combined status')
|
||||
.get('/badges/shields.json')
|
||||
.expectBadge({
|
||||
label: 'hacktoberfest',
|
||||
message: isHactoberfestCombinedStatus,
|
||||
message: isHacktoberfestStatus,
|
||||
})
|
||||
|
||||
t.create('GitHub Hacktoberfest combined status (suggestion label override)')
|
||||
@@ -22,5 +34,5 @@ t.create('GitHub Hacktoberfest combined status (suggestion label override)')
|
||||
)
|
||||
.expectBadge({
|
||||
label: 'hacktoberfest',
|
||||
message: isHactoberfestCombinedStatus,
|
||||
message: isHacktoberfestStatus,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user