Skip to content

Commit

Permalink
Fix up test, move it nearer to the other error handling ones
Browse files Browse the repository at this point in the history
  • Loading branch information
papandreou committed Nov 16, 2018
1 parent 4d9d5a7 commit 99d3d78
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions test/OptiPng.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,6 @@ const Path = require('path');
const fs = require('fs');

describe('OptiPng', () => {
it('should end the stream even if it hasnt written to it yet', function(done) {
var optiPng = new OptiPng(['-o7']);

optiPng.on('error', e => {
expect(e.message, 'to be', 'Closing stream before writing data.');
done();
});

optiPng.end();
});

it('should produce a smaller file when run with -o7 on a suboptimal PNG', () =>
expect(
fs.createReadStream(Path.resolve(__dirname, 'suboptimal.png')),
Expand Down Expand Up @@ -78,6 +67,17 @@ describe('OptiPng', () => {
optiPng.end(Buffer.from('qwvopeqwovkqvwiejvq', 'utf-8'));
});

it('should end the output stream properly even if no data has been piped in', done => {
const optiPng = new OptiPng(['-o7']);

optiPng.on('error', e => {
expect(e.message, 'to be', 'Closing stream before writing data.');
done();
});

optiPng.end();
});

it('should emit a single error if an invalid command line is specified', done => {
const optiPng = new OptiPng(['-vqve']);

Expand Down

0 comments on commit 99d3d78

Please sign in to comment.