test: server PNG.
This commit is contained in:
parent
a35ab25f61
commit
84f680db4f
|
@ -1,3 +1,5 @@
|
|||
require('ass'); require('../server.js');
|
||||
// We don't require ass because we can't test a majority of the server reliably.
|
||||
//require('ass');
|
||||
require('../server.js');
|
||||
console.log('done');
|
||||
process.on('SIGTERM', function() { process.exit(0); });
|
||||
|
|
|
@ -1 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="110" height="18"><linearGradient id="a" x2="0" y2="100%"><stop offset="0" stop-color="#fff" stop-opacity=".7"/><stop offset=".1" stop-color="#aaa" stop-opacity=".1"/><stop offset=".9" stop-opacity=".3"/><stop offset="1" stop-opacity=".5"/></linearGradient><rect rx="4" width="110" height="18" fill="#555"/><rect rx="4" x="63" width="47" height="18" fill="#e05d44"/><path fill="#e05d44" d="M63 0h4v18h-4z"/><rect rx="4" width="110" height="18" fill="url(#a)"/><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"><text x="32.5" y="13" fill="#010101" fill-opacity=".3">coverage</text><text x="32.5" y="12">coverage</text><text x="85.5" y="13" fill="#010101" fill-opacity=".3">38.3%</text><text x="85.5" y="12">38.3%</text></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="110" height="18"><linearGradient id="a" x2="0" y2="100%"><stop offset="0" stop-color="#fff" stop-opacity=".7"/><stop offset=".1" stop-color="#aaa" stop-opacity=".1"/><stop offset=".9" stop-opacity=".3"/><stop offset="1" stop-opacity=".5"/></linearGradient><rect rx="4" width="110" height="18" fill="#555"/><rect rx="4" x="63" width="47" height="18" fill="#a4a61d"/><path fill="#a4a61d" d="M63 0h4v18h-4z"/><rect rx="4" width="110" height="18" fill="url(#a)"/><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"><text x="32.5" y="13" fill="#010101" fill-opacity=".3">coverage</text><text x="32.5" y="12">coverage</text><text x="85.5" y="13" fill="#010101" fill-opacity=".3">83.9%</text><text x="85.5" y="12">83.9%</text></g></svg>
|
Before Width: | Height: | Size: 827 B After Width: | Height: | Size: 827 B |
22
test.js
22
test.js
|
@ -50,7 +50,6 @@ describe('the CLI', function() {
|
|||
child = cproc.spawn('node',
|
||||
['ass-stubs/cli-test.js', 'cactus', 'grown', '.png']);
|
||||
child.stdout.on('data', function(chunk) {
|
||||
var buffer = ''+chunk;
|
||||
// Check the PNG magic number.
|
||||
chunk[0].should.equal(0x89);
|
||||
chunk[1].should.equal(0x50);
|
||||
|
@ -67,6 +66,7 @@ describe('the CLI', function() {
|
|||
|
||||
describe('the server', function() {
|
||||
var port = '1111';
|
||||
var url = 'http://127.0.0.1:' + port + '/';
|
||||
var server;
|
||||
|
||||
// Start running the server.
|
||||
|
@ -77,7 +77,7 @@ describe('the server', function() {
|
|||
});
|
||||
|
||||
it('should produce colorscheme badges', function(done) {
|
||||
http.get('http://127.0.0.1:' + port + '/:fruit-apple-green.svg',
|
||||
http.get(url + ':fruit-apple-green.svg',
|
||||
function(res) {
|
||||
var buffer = '';
|
||||
res.on('data', function(chunk) { buffer += ''+chunk; });
|
||||
|
@ -90,6 +90,24 @@ describe('the server', function() {
|
|||
});
|
||||
});
|
||||
|
||||
it('should produce colorscheme PNG badges', function(done) {
|
||||
http.get(url + ':fruit-apple-green.png',
|
||||
function(res) {
|
||||
res.on('data', function(chunk) {
|
||||
// Check the PNG magic number.
|
||||
chunk[0].should.equal(0x89);
|
||||
chunk[1].should.equal(0x50);
|
||||
chunk[2].should.equal(0x4e);
|
||||
chunk[3].should.equal(0x47);
|
||||
chunk[4].should.equal(0x0d);
|
||||
chunk[5].should.equal(0x0a);
|
||||
chunk[6].should.equal(0x1a);
|
||||
chunk[7].should.equal(0x0a);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should shut down', function(done) {
|
||||
server.kill();
|
||||
server.on('exit', function() { done(); });
|
||||
|
|
Loading…
Reference in New Issue
Block a user