Refactor badge color functions (#2742)

- Replace the idea of color schemes with the idea of named colors (since none of our colorschemes have used `colorA`)
- Pass through the normalized color to `_shields_test` to harmonize with BaseService and simplify testing
    - Update service tests
- Move responsibility for color generation into the npm package
- Remove several color helper functions and their tests
- Update gh-badge public API to accept `color` and `labelColor`

This is a precursor to refactoring some of the logo code for #2473.
This commit is contained in:
Paul Melnikow
2019-01-15 16:43:33 -05:00
committed by GitHub
parent cab689706f
commit 4597d77015
81 changed files with 492 additions and 669 deletions

View File

@@ -229,8 +229,6 @@ static render({ status, result }) {
We can also use nock to intercept API calls to return a known response body.
```js
const { colorScheme } = require('../test-helpers')
t.create('Build passed (mocked)')
.get('/build/wercker/go-wercker-api.json?style=_shields_test')
.intercept(nock =>
@@ -241,7 +239,7 @@ t.create('Build passed (mocked)')
.expectJSON({
name: 'build',
value: 'passing',
colorB: colorScheme.brightgreen,
color: 'brightgreen',
})
t.create('Build failed (mocked)')