Files
shields/entrypoint.spec.js
Marcin Mielnicki 2462951254 Run entrypoint tests in CI (#3390)
* Start server in test without args from mocha

* Entrypoint tests added to CI
2019-04-29 19:09:52 +02:00

28 lines
652 B
JavaScript

'use strict'
const { expect } = require('chai')
const fetch = require('node-fetch')
const isSvg = require('is-svg')
let server
before(function() {
this.timeout('5s')
// remove args comming from mocha
// https://github.com/badges/shields/issues/3365
process.argv = []
server = require('./server')
})
after('shut down the server', async function() {
await server.stop()
})
it('should render a badge', async function() {
const res = await fetch('http://localhost:1111/badge/fruit-apple-green.svg')
expect(res.ok).to.be.true
expect(await res.text())
.to.satisfy(isSvg)
.and.to.include('fruit')
.and.to.include('apple')
})