Repository: badges/shields (js)

Issue:
Hacktoberfest service test failing
:clock11: **When did the problem start?**
~Nov 3rd

<!-- Indicate when the problem started -->

:camera: **Live badge**
https://img.shields.io/github/hacktoberfest/2019/snyk/snyk
![](https://img.shields.io/github/hacktoberfest/2019/snyk/snyk)

:wrench: **Is the live badge working?**
Yes

<!-- Indicate whether or not the live badge is working. -->

:link: **CircleCI link**
https://circleci.com/gh/badges/daily-tests/705
<!-- Provide a link to the failing test in CircleCI. -->

:beetle: **Stack trace**

```
GithubHacktoberfestCombinedStatus [live] GitHub Hacktoberfest combined status [ GET /badges/shields.json ]
  ValidationError: message mismatch: "value" with value "127 PRs" fails to match the required pattern: /^[0-9]+ open issues?(, [0-9]+ PRs?)?(, [0-9]+ days? left)?$/
```

:bulb: **Possible solution**
The regex validator used for the service tests is expecting there to be at least 1 issue with the `hacktoberfest` label. I went through our issues the other day and removed those labels, and since the service test is using this repo, the test started failing. 

We just need to update the regex

<!--- Optional: only if you have suggestions on a fix/reason for the bug -->

<!-- Love Shields? Please consider donating $10 to sustain our activities:
👉  https://opencollective.com/shields -->


Pull request:
fix [GitHubHacktoberfest] service test
Fixes #4298 

I also removed our Hacktoberfest badge from our readme now that we've transitioned into November. 

Related aside, while working on this I find myself wondering what this badge should look like outside October/Hacktoberfest. It looks like it will only display the `is over!` message if there are no `hacktoberfest`-labeled issues, there were no PRs opened during October, and October has ended.

Would it make sense to display `is over!` after Hacktoberfest has ended regardless? 

Patch:
diff --git a/README.md b/README.md
index 124612b354..7388bf49df 100644
--- a/README.md
+++ b/README.md
@@ -84,7 +84,6 @@ When adding or changing a service [please add tests][service-tests].
 This project has quite a backlog of suggestions! If you're new to the project,
 maybe you'd like to open a pull request to address one of them:
 
-[![Hacktoberfest](https://img.shields.io/github/hacktoberfest/2019/badges/shields)](https://github.com/badges/shields/issues?q=is%3Aopen+is%3Aissue+label%3Ahacktoberfest)
 [![GitHub issues by-label](https://img.shields.io/github/issues/badges/shields/good%20first%20issue)](https://github.com/badges/shields/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)
 
 You can read a [tutorial on how to add a badge][tutorial].
diff --git a/services/github/github-hacktoberfest.service.js b/services/github/github-hacktoberfest.service.js
index bfbc5aa0a9..0192793a39 100644
--- a/services/github/github-hacktoberfest.service.js
+++ b/services/github/github-hacktoberfest.service.js
@@ -120,7 +120,14 @@ module.exports = class GithubHacktoberfestCombinedStatus extends GithubAuthV4Ser
       // We want to show "1 day left" on the last day so we add 1.
       daysLeft = moment('2019-11-01 12:00:00 Z').diff(moment(), 'days') + 1
     }
-
+    if (daysLeft < 0) {
+      return {
+        message: `is over! (${metric(contributionCount)} ${maybePluralize(
+          'PR',
+          contributionCount
+        )} opened)`,
+      }
+    }
     const message =
       [
         suggestedIssueCount
@@ -140,7 +147,7 @@ module.exports = class GithubHacktoberfestCombinedStatus extends GithubAuthV4Ser
           : '',
       ]
         .filter(Boolean)
-        .join(', ') || 'is done!'
+        .join(', ') || 'is over!'
 
     return { message }
   }
diff --git a/services/github/github-hacktoberfest.spec.js b/services/github/github-hacktoberfest.spec.js
new file mode 100644
index 0000000000..b62bbe765a
--- /dev/null
+++ b/services/github/github-hacktoberfest.spec.js
@@ -0,0 +1,22 @@
+'use strict'
+
+const { test, given } = require('sazerac')
+const GitHubHacktoberfest = require('./github-hacktoberfest.service')
+
+describe('GitHubHacktoberfest', function() {
+  test(GitHubHacktoberfest.render, () => {
+    given({
+      daysLeft: -1,
+      contributionCount: 12,
+    }).expect({
+      message: 'is over! (12 PRs opened)',
+    })
+    given({
+      daysLeft: 10,
+      contributionCount: 27,
+      suggestedIssueCount: 54,
+    }).expect({
+      message: '54 open issues, 27 PRs, 10 days left',
+    })
+  })
+})


Test patch:
diff --git a/services/github/github-hacktoberfest.tester.js b/services/github/github-hacktoberfest.tester.js
index 532ecfbe36..51eb74c164 100644
--- a/services/github/github-hacktoberfest.tester.js
+++ b/services/github/github-hacktoberfest.tester.js
@@ -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,
   })