Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚢 Deploy! #1742

Closed
wants to merge 83 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
400ae01
Add circleci logo (#1595)
Mar 25, 2018
0a24899
Only compute user/repo if suggesting badges for GitHub (#1601)
espadrine Mar 25, 2018
17ddd18
Skip Twitter suggestion if URL does not have protocol (#1604)
espadrine Mar 26, 2018
ed419b0
[microbadger] Fix tests (#1600)
PyvesB Mar 27, 2018
7e239f7
chore(package): update semver-regex to version 2.0.0 (#1596)
greenkeeper[bot] Mar 28, 2018
01646de
upgrade glob to be a prod dependency (#1619)
philipithomas Mar 28, 2018
16eea6d
Number support for version color formatter (#1615)
PyvesB Mar 29, 2018
1dff491
Added number support to version text formatter (#1620)
PyvesB Mar 29, 2018
ac7c418
Extract examples from new-style services (#1582)
paulmelnikow Mar 30, 2018
66c5d91
[CircleCI] Extended existing try-catch block (#1614)
PyvesB Mar 30, 2018
0d5b48b
"commits to be deployed" replaced "last deployed" (#1605)
platan Mar 30, 2018
57008d2
Test path escaping - mocha windows fix (#1627)
RedSparr0w Apr 1, 2018
c5884b1
Handled capitalization with empty keys (#1625)
PyvesB Apr 1, 2018
dd35739
[CodeClimate] Added missing try-catch block (#1613)
PyvesB Apr 1, 2018
f9b0aed
package-lock fixes for glob (#1633)
paulmelnikow Apr 2, 2018
724abd0
Update svgo to the latest version 🚀 (#1473)
greenkeeper[bot] Apr 2, 2018
416d433
[appveyor] Error handling in BaseService (#1590)
paulmelnikow Apr 2, 2018
3aa2130
[Ansible] Handle no data responses (#1629)
PyvesB Apr 2, 2018
a168072
[DotnetStatus] Service deprecation (#1630)
PyvesB Apr 2, 2018
f2efd75
Minor refactor of examples preparation (#1632)
paulmelnikow Apr 2, 2018
f98d17e
[SourceForge] Fixes, tests and cleaning up (#1626)
PyvesB Apr 2, 2018
c0bdf54
optimize cssColor check regex (#1602)
RedSparr0w Apr 4, 2018
47614e5
Add Stack Exchange logos (#1636)
rsp Apr 6, 2018
d56b696
Add [dynamic-yaml] badge (#1623)
jacobtomlinson Apr 8, 2018
e1755df
[vaadin-directory] Support `star` and `stars` endpoints (#1603)
binhbbui411 Apr 9, 2018
ac13fdb
[librariesio] Missing try/catch block and tests (#1644)
PyvesB Apr 14, 2018
d2a144e
update [pypi] to use warehouse (closes #1569) (#1648)
chris48s Apr 15, 2018
2ded83f
Documentation typos (#1647)
tbroadley Apr 15, 2018
8fda86f
set expires header corresponding to maxAge (#1651)
RedSparr0w Apr 22, 2018
da10896
Add NPM logo (#1656)
omrilotan Apr 22, 2018
f607ad7
Add [buildkite] service (#1657)
raulriera Apr 23, 2018
a24d42a
minor links fix (#1658)
andreaTP Apr 24, 2018
14bdaf3
[Codeship] fix status checking regexp & add new statuses (#1662)
zosiu Apr 26, 2018
2e87ed9
add codeship logo (#1663)
RedSparr0w Apr 28, 2018
714df8f
change CC0 example in GH service tests (#1634)
chris48s Apr 28, 2018
b126b4e
checkErrorResponse documented in service tests (#1670)
platan May 2, 2018
8fcc13d
refactor [cdnjs] integration (#1668)
chris48s May 4, 2018
45ff94d
Add [LGTM] service (#1672)
s0 May 5, 2018
0ef1c94
open badge links in new tab (#1667)
chris48s May 5, 2018
726dc9d
Add LGTM logo (#1673)
s0 May 5, 2018
3518b64
[MicroBadger] Fixed tests (#1677)
PyvesB May 7, 2018
6dab822
checkErrorResponse documented in the tutorial (#1675)
platan May 9, 2018
f43096a
replace lgtm logo with improved one (#1679)
s0 May 10, 2018
b5635bf
[gem cdnjs appveyor] refactor ruby gems service (#1680)
chris48s May 10, 2018
4f8414c
Add grade badge for [lgtm] (#1681)
s0 May 12, 2018
bf53e61
[cdnjs gem] make exception classes more consistent (#1683)
chris48s May 15, 2018
d51ae90
Bugfix: override colorB in [docker] badges (#1690)
platan May 16, 2018
c76e221
[david] add support for path (#1687)
rraziel May 17, 2018
37617c1
Add Liberapay logo (#1692)
mattbk May 18, 2018
498684c
Adapt to new JSON API of formulae.brew.sh (#1684)
koraktor May 21, 2018
c6b6183
Update pretty-bytes to the latest version 🚀 (#1676)
greenkeeper[bot] May 21, 2018
3ff98bf
update request (#1695)
chris48s May 22, 2018
5d4ab86
upgrade to Joi 13.3.0 (#1696)
chris48s May 22, 2018
960c5bf
upgrade sinon (#1697)
chris48s May 22, 2018
8ba33d4
[bower clojars] version() should throw on invalid inputs (#1705)
chris48s May 28, 2018
de4e527
service tests for [libscore], improve error handling (#1706)
chris48s May 29, 2018
7c7c9f5
Ensure both docker CMDs are invoked (#1686)
elordahl May 30, 2018
9d90bd1
[github] Commit merge status badge (#1709)
platan May 30, 2018
57a1bf2
add more rules to dangerfile (#1703)
chris48s May 30, 2018
e6559a0
fix typescript regex in [npm] tests (#1712)
chris48s Jun 2, 2018
f4ea029
service tests for Arch Linux [aur] (#1707)
chris48s Jun 2, 2018
83007a0
Update nyc to the latest version 🚀 (#1716)
greenkeeper[bot] Jun 3, 2018
707ada3
Update snap-shot-it to the latest version 🚀 (#1715)
greenkeeper[bot] Jun 3, 2018
fa52c04
allow 0 for cocoapods weekly downloads (#1713)
chris48s Jun 7, 2018
7f9102d
Add ReSharper gallery badge. (#1722)
matkoch Jun 9, 2018
b418235
Standard name in nuget v2 downloads badge (#1726)
platan Jun 10, 2018
e8980f7
fix 'not found' case in [node] badge (#1730)
chris48s Jun 10, 2018
67eb92e
fix [dub] service test (#1729)
chris48s Jun 10, 2018
124748e
Fix [codeclimate] tests (#1727)
chris48s Jun 10, 2018
1f92828
allow 0 in all [cocoapods] download tests (#1728)
chris48s Jun 13, 2018
2683f74
Required files added to now.json config (#1718)
platan Jun 15, 2018
12e0164
Probot workflow configuration with deployment status (#1724)
platan Jun 15, 2018
9612d5c
Update sinon to the latest version 🚀 (#1733)
greenkeeper[bot] Jun 16, 2018
fc3b793
extend for pr in title (#1720)
tooomm Jun 16, 2018
20b8d0c
BaseService: Query params (#1589)
paulmelnikow Jun 16, 2018
f78e6f1
[gem cdnjs appveyor clojars] refactor clojars, establish BaseJsonServ…
chris48s Jun 16, 2018
fa61247
Rewrite [npm] typedefs badge using new-style service (#1735)
paulmelnikow Jun 16, 2018
7cd3720
Update prettier to the latest version 🚀 (#1641)
greenkeeper[bot] Jun 16, 2018
4308b60
[Travis] Add travis-ci.com support (#1711)
Jun 17, 2018
028d8d7
Fix sinon deprecation warning (#1737)
paulmelnikow Jun 17, 2018
ca58d84
Add [dependabot] SemVer compatibility badge (#1734)
greysteil Jun 17, 2018
def1bc3
fix [sonar] legacy/unsupported service tests (#1741)
chris48s Jun 18, 2018
ec6d903
Test in now-released Node 10 instead of Node 9 (#1738)
paulmelnikow Jun 19, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
jobs:
npm-install:
docker:
- image: shieldsio/shields-ci-node-8:0.0.2
- image: shieldsio/shields-ci-node-8:0.0.3
working_directory: ~/repo
steps:
- checkout
Expand Down Expand Up @@ -33,7 +33,7 @@ jobs:

main:
docker:
- image: shieldsio/shields-ci-node-8:0.0.2
- image: shieldsio/shields-ci-node-8:0.0.3
working_directory: ~/repo
steps:
- checkout
Expand Down Expand Up @@ -63,9 +63,9 @@ jobs:
CI_PULL_REQUEST: ''
command: greenkeeper-lockfile-upload

main@node-9:
main@node-latest:
docker:
- image: shieldsio/shields-ci-node-9:0.0.2
- image: shieldsio/shields-ci-node-latest:0.0.3
working_directory: ~/repo
steps:
- checkout
Expand All @@ -85,7 +85,7 @@ jobs:

frontend:
docker:
- image: shieldsio/shields-ci-node-8:0.0.2
- image: shieldsio/shields-ci-node-8:0.0.3
working_directory: ~/repo
steps:
- checkout
Expand All @@ -105,7 +105,7 @@ jobs:

services-pr:
docker:
- image: shieldsio/shields-ci-node-8:0.0.2
- image: shieldsio/shields-ci-node-8:0.0.3
working_directory: ~/repo
steps:
- checkout
Expand Down Expand Up @@ -137,9 +137,9 @@ jobs:
echo 'This is not a pull request. Skipping.'
fi

services-pr@node-9:
services-pr@node-latest:
docker:
- image: shieldsio/shields-ci-node-9:0.0.2
- image: shieldsio/shields-ci-node-latest:0.0.3
working_directory: ~/repo
steps:
- checkout
Expand Down Expand Up @@ -173,7 +173,7 @@ jobs:

services-daily:
docker:
- image: shieldsio/shields-ci-node-8:0.0.2
- image: shieldsio/shields-ci-node-8:0.0.3
working_directory: ~/repo
steps:
- checkout
Expand All @@ -197,7 +197,7 @@ workflows:
- main:
requires:
- npm-install
- main@node-9:
- main@node-latest:
requires:
- npm-install
- frontend:
Expand All @@ -206,7 +206,7 @@ workflows:
- services-pr:
requires:
- npm-install
- services-pr@node-9:
- services-pr@node-latest:
requires:
- npm-install

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:9
FROM node:latest
ADD .circleci/images/prepare-container.sh /root/prepare-container.sh
RUN /root/prepare-container.sh
RUN rm /root/prepare-container.sh
8 changes: 8 additions & 0 deletions .github/probot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
on('pull_request.closed')
.filter(context => context.payload.pull_request.merged)
.filter(context => context.payload.pull_request.base.ref === 'master')
.comment(`This pull request was merged to [{{ pull_request.base.ref }}]({{ repository.html_url }}/tree/{{ pull_request.base.ref }}) branch. Now this change is waiting for deployment.
Deploys usually happen every few weeks. After deployment changes are copied to [gh-pages]({{ repository.html_url }}/tree/gh-pages) branch.

This badge displays deployment status:
![](https://shields-deployment.now.sh/github/commit-status/{{ repository.full_name }}/gh-pages/{{ pull_request.merge_commit_sha }}.svg?label=deploy%20status)`)
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,4 @@ typings/
# Temporary build artifacts.
/build
.next
badge-examples.json
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ There are three places to get help:
Badge guidelines
----------------

- The left-hand side of a badge should not advertize. It should be a *noun*
- The left-hand side of a badge should not advertise. It should be a *noun*
succinctly describing the meaning of the right-hand side.
- Query parameters must be *declared by the service*. See `request-handler.js`.
- Except for badges using the `social` style, logos should be *turned off by
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN npm run build
RUN npm prune --production
RUN npm cache clean --force

CMD envsubst < secret.tpl.json > ./private/secret.json
CMD node server
CMD envsubst < secret.tpl.json > ./private/secret.json \
&& node server

EXPOSE 80
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<a href="https://circleci.com/gh/badges/shields/tree/master">
<img src="https://img.shields.io/circleci/project/github/badges/shields.svg"
alt="build status"></a>
<a href="https://github.com/badges/shields/commits/gh-pages">
<img src="https://img.shields.io/github/last-commit/badges/shields/gh-pages.svg?label=last%20deployed"
alt="last deployed"></a>
<a href="https://github.com/badges/shields/compare/gh-pages...master">
<img src="https://img.shields.io/github/commits-since/badges/shields/gh-pages.svg?label=commits%20to%20be%20deployed"
alt="commits to be deployed"></a>
<a href="https://discord.gg/HjJCwm5">
<img src="https://img.shields.io/discord/308323056592486420.svg?logo=discord"
alt="chat on Discord"></a>
Expand Down
26 changes: 26 additions & 0 deletions dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,29 @@ if (capitals.created || underscores.created) {
'(dash-separated lowercase).',
].join(''));
}

const all_files = danger.git.created_files.concat(danger.git.modified_files);

all_files.forEach(function(file) {
danger.git.diffForFile(file).then(function(diff) {
if (/\+.*assert[(.]/.test(diff.diff)) {
warn([
`Found 'assert' statement added in ${file}. `,
'Please ensure tests are written using Chai ',
'[expect syntax](http://chaijs.com/guide/styles/#expect)'
].join(''));
}
});
});

all_files.forEach(function(file) {
if (/^services\/.+\/.+\.js$/.test(file) && file.endsWith('.js') && !file.endsWith('.tester.js')) {
const tester = file.replace('.js', '.tester.js');
if (all_files.indexOf(tester) == -1) {
warn([
`This PR modified ${file} but not ${tester}. `,
"That's okay so long as it's refactoring existing code.",
].join(''));
}
}
});
39 changes: 21 additions & 18 deletions doc/TUTORIAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ This example is the for the Docker Hub automated integration. ([Source][docker-e

```js
// Docker Hub automated integration. // (1)
camp.route(/^\/docker\/automated\/([^\/]+)\/([^\/]+)\.(svg|png|gif|jpg|json)$/, // (2)
camp.route(/^\/docker\/automated\/([^/]+)\/([^/]+)\.(svg|png|gif|jpg|json)$/, // (2)
cache(function(data, match, sendBadge, request) { // (2)
var user = match[1]; // eg, jrottenberg // (3)
var repo = match[2]; // eg, ffmpeg // (3)
Expand All @@ -121,22 +121,21 @@ cache(function(data, match, sendBadge, request) {
var url = 'https://registry.hub.docker.com/v2/repositories/' + path; // (4)
var badgeData = getBadgeData('docker build', data); // (5)
request(url, function(err, res, buffer) { // (6)
if (err != null) { // (7)
badgeData.text[1] = 'inaccessible'; // (7)
if (checkErrorResponse(badgeData, err, res, 'repo not found')) { // (7)
sendBadge(format, badgeData); // (7)
return; // (7)
}
try {
var data = JSON.parse(buffer); // (8)
var is_automated = data.is_automated; // (8)
var parsedData = JSON.parse(buffer); // (8)
var is_automated = parsedData.is_automated; // (8)
if (is_automated) {
badgeData.text[1] = 'automated'; // (9)
badgeData.colorscheme = 'blue'; // (9)
} else {
badgeData.text[1] = 'manual'; // (9)
badgeData.colorscheme = 'yellow'; // (9)
}
badgeData.colorB = '#008bb8'; // (9)
badgeData.colorB = data.colorB || '#008bb8'; // (9)
sendBadge(format, badgeData); // (9)
} catch(e) { // (10)
badgeData.text[1] = 'invalid'; // (10)
Expand All @@ -154,11 +153,11 @@ The following numbering explains what happens in the corresponding lines.
Usually, badges with a similar topic have their implementation close to each other's.
2. The [regular expression][regex] matches the path behind the host name in the URL, e.g. `img.shields.io`.
```
/^\/docker\/automated\/([^\/]+)\/([^\/]+)\.(svg|png|gif|jpg|json)$/
\.(svg|png|gif|jpg|json)
The supported endings
e.g. ".svg"
([^\/]+)\/([^\/]+)
/^\/docker\/automated\/([^/]+)\/([^/]+)\.(svg|png|gif|jpg|json)$/
\.(svg|png|gif|jpg|json)
The supported endings
e.g. ".svg"
([^/]+)\/([^/]+)
The name of the repository
e.g. "jrottenberg/ffmpeg"
\/docker\/automated\/
Expand All @@ -173,19 +172,23 @@ The following numbering explains what happens in the corresponding lines.
The `url` is created to query the API.
5. Create the basic badge to use.
You can read about the [different formats available][format].
It contains the format for all responses, regarless of the API's response.
It contains the format for all responses, regardless of the API's response.
6. We request the `url` and pass a call back function to the request.
The function is called once the data is retrieved from the API.
7. We want to always see a badge regardless the input.
In some cases the API may return an error e.g. if the query was invalid.
The error is handled and a badge with the the status "inaccessible" is returned.
![](https://img.shields.io/badge/docker%20build-inaccessible-lightgrey.svg)
In some cases the API may return an error or a HTTP status code indicating
a client error or a server error e.g. if the query was invalid. The error response
is handled by the [checkErrorResponse](https://github.com/badges/shields/blob/8fcc13d5bced23f53c9f075e51b419060f6cc124/lib/error-helper.js#L8)
function and a badge with an appropriate status is returned: "inaccessible"
![](https://img.shields.io/badge/docker_build-inaccessible-red.svg), "not found"
![](https://img.shields.io/badge/docker_build-not_found-lightgrey.svg)
or "invalid" ![](https://img.shields.io/badge/docker_build-invalid-lightgrey.svg).
8. The data returned by the API as JSON is parsed.
9. Based on the result, the text and the color of the badge are altered.
![](https://img.shields.io/docker/automated/jrottenberg/ffmpeg.svg)
![](https://img.shields.io/docker/automated/codersos/ubuntu-remix.svg)
10. In case of an error, an "invalid" badge is constructed.
![](https://img.shields.io/docker/automated/,/ubuntu-remix.svg)
![](https://img.shields.io/badge/docker_build-invalid-lightgrey.svg)

The pattern described can be found in may other badges.
When you look at the [server.js][server], you find many other badges.
Expand Down Expand Up @@ -269,7 +272,7 @@ These files can also be of help for creating your own badge.
[edit]: https://github.com/badges/shields/edit/master/doc/TUTORIAL.md
[add-pr]: https://github.com/badges/shields/issues?utf8=%E2%9C%93&q=is%3Aissue%20in%3Atitle%20add%20
[new-badge]: https://github.com/badges/shields/pulls?q=is%3Apr+label%3Anew-badge
[docker-example]: https://github.com/badges/shields/blob/bf373d11cd522835f198b50b4e1719027a0a2184/server.js#L5014
[travis-example]: https://github.com/badges/shields/blob/bf373d11cd522835f198b50b4e1719027a0a2184/server.js#L431
[docker-example]: https://github.com/badges/shields/blob/b126b4ebdc64015a3d6e845d9c051f69ad81c4ea/server.js#L6275
[travis-example]: https://github.com/badges/shields/blob/b126b4ebdc64015a3d6e845d9c051f69ad81c4ea/server.js#L403
[regex]: https://www.w3schools.com/jsref/jsref_obj_regexp.asp
[tests-tutorial]: ../service-tests/#readme
4 changes: 2 additions & 2 deletions doc/gh-badges.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ The format is the following:

### See also

- [colorscheme.json](lib/colorscheme.json) for the `colorscheme` option
- [templates/](templates) for the `template` option
- [colorscheme.json](../lib/colorscheme.json) for the `colorscheme` option
- [templates/](../templates) for the `template` option


Defaults
Expand Down
13 changes: 7 additions & 6 deletions doc/service-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,15 @@ cache(function(data, match, sendBadge, request) {
uri: 'https://api.travis-ci.org/' + userRepo + '.svg',
};
if (branch != null) {
options.uri += '?branch=' + branch; // (3)
options.uri += '?branch=' + branch; // 3
}
var badgeData = getBadgeData('build', data);
request(options, function(err, res) {
if (err != null) {
console.error('Travis error: ' + err.stack); // 5
if (res) { console.error(''+res); }
badgeData.text[1] = 'inaccessible';
log.error('Travis error: ' + err.stack);
if (res) { log.error(''+res); }
}
if (checkErrorResponse(badgeData, err, res)) { // 5
sendBadge(format, badgeData);
return;
}
Expand Down Expand Up @@ -264,8 +265,8 @@ npm run coverage:report:open
```

After searching `server.js` for the Travis code, we see that we've missed a
big block: the error branch in the request callback. To test that, we simulate
network connection errors on any unmocked requests.
big block which is executed when `checkErrorResponse` returns `true`. To test
that, we simulate network connection errors on any unmocked requests.

```js
t.create('connection error')
Expand Down
1 change: 1 addition & 0 deletions frontend/components/dynamic-badge-maker.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default class DynamicBadgeMaker extends React.Component {
<option value="" disabled>data type</option>
<option value="json">json</option>
<option value="xml">xml</option>
<option value="yaml">yaml</option>
</select> {}
<input
className="short"
Expand Down
3 changes: 3 additions & 0 deletions frontend/components/usage.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ export default class Usage extends React.PureComponent {
<p>
<code>/badge/dynamic/xml.svg?url=&lt;URL&gt;&amp;label=&lt;LABEL&gt;&amp;query=&lt;<a href="https://www.npmjs.com/package/xpath" target="_BLANK" title="XPath syntax">//data/subdata</a>&gt;&amp;colorB=&lt;COLOR&gt;&amp;prefix=&lt;PREFIX&gt;&amp;suffix=&lt;SUFFIX&gt;</code>
</p>
<p>
<code>/badge/dynamic/yaml.svg?url=&lt;URL&gt;&amp;label=&lt;LABEL&gt;&amp;query=&lt;<a href="https://www.npmjs.com/package/jsonpath" target="_BLANK" title="JSONdata syntax">$.DATA.SUBDATA</a>&gt;&amp;colorB=&lt;COLOR&gt;&amp;prefix=&lt;PREFIX&gt;&amp;suffix=&lt;SUFFIX&gt;</code>
</p>

<hr className="spacing" />

Expand Down
28 changes: 3 additions & 25 deletions frontend/lib/badge-url.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,43 +38,21 @@ describe('Badge URL functions', function() {
});

test(dynamicBadgeUrl, () => {
const jsonUrl = 'http://example.com/foo.json';
const dataUrl = 'http://example.com/foo.json';
const query = '$.bar';
const prefix = 'value: ';

given(
'http://img.example.com',
'json',
'foo',
jsonUrl,
dataUrl,
query,
{ prefix, style: 'plastic' }
).expect([
'http://img.example.com/badge/dynamic/json.svg',
'?label=foo',
`&url=${encodeURIComponent(jsonUrl)}`,
`&query=${encodeURIComponent(query)}`,
`&prefix=${encodeURIComponent(prefix)}`,
'&style=plastic',
].join(''))
});

test(dynamicBadgeUrl, () => {
const xmlUrl = 'http://example.com/foo.xml';
const query = '//bar';
const prefix = 'value: ';

given(
'http://img.example.com',
'xml',
'foo',
xmlUrl,
query,
{ prefix, style: 'plastic' }
).expect([
'http://img.example.com/badge/dynamic/xml.svg',
'?label=foo',
`&url=${encodeURIComponent(xmlUrl)}`,
`&url=${encodeURIComponent(dataUrl)}`,
`&query=${encodeURIComponent(query)}`,
`&prefix=${encodeURIComponent(prefix)}`,
'&style=plastic',
Expand Down
Loading