Add SymfonyInsight stars badge, run [SymfonyInsight sensiolabs amo chrome-web-store redmine spigetratings vaadin-directory visualstudiomarketplacerating wordpress] (#2971)

* feat: added stars badge for symfony insight

* refactor: changed symfony star determination logic

* feat: updating symfony to handle old scan scenarios

* feat: updated symfony insight to handle older projects

* tests: removed another test for symfony insight per request
This commit is contained in:
Caleb Cartwright
2019-02-20 17:15:31 -06:00
committed by GitHub
parent 96d48dc486
commit a4bd3f5fd6
14 changed files with 827 additions and 608 deletions

View File

@@ -7,7 +7,7 @@
const moment = require('moment')
moment().format()
function starRating(rating) {
function starRating(rating, max = 5) {
const flooredRating = Math.floor(rating)
let stars = ''
while (stars.length < flooredRating) {
@@ -23,7 +23,8 @@ function starRating(rating) {
} else if (decimal >= 0.125) {
stars += '¼'
}
while (stars.length < 5) {
while (stars.length < max) {
stars += '☆'
}
return stars

View File

@@ -23,6 +23,7 @@ describe('Text formatters', function() {
given(2.566).expect('★★½☆☆')
given(2.2).expect('★★¼☆☆')
given(3).expect('★★★☆☆')
given(2, 4).expect('★★☆☆')
})
test(currencyFromCode, () => {