Skip to content

Commit

Permalink
minor test improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
gforge committed May 9, 2019
1 parent 7fa74d3 commit 2de9570
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
23 changes: 23 additions & 0 deletions test/metadata.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env babel-node
import fs from 'fs';
import PNG from '../lib';
import test from 'tape';

test('Check same image saved in different modes generate the same buffers', (t) => {
t.timeoutAfter(1000 * 60 * 5);

const grayscaleGradient = __dirname + '/imgs/img8_gradient.png';
const grayPNG = new PNG();
fs.createReadStream(grayscaleGradient)
.pipe(grayPNG)
.on('error', (error) => {
t.fail(`Failed to convert grayscale file: ${error.message}`);
t.end();
})
.on('parsed', () => {
t.equal(grayPNG.width, 50);
t.equal(grayPNG.height, 100);
t.equal(grayPNG.color, false);
t.end();
});
});
5 changes: 2 additions & 3 deletions test/same_img_different_format-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ test('Check same image saved in different modes generate the same buffers', func
t.end();
});


test('Check same image saved in different modes generate the same buffers in async with stream', function(t) {
t.timeoutAfter(1000 * 60 * 5);

Expand All @@ -56,7 +55,7 @@ test('Check same image saved in different modes generate the same buffers in asy
fs.createReadStream(grayscaleGradient)
.pipe(grayPNG)
.on('error', function(error) {
t.fail(`Failed to convert gratscale file: ${error.message}`);
t.fail(`Failed to convert grayscale file: ${error.message}`);
t.end();
})
.on('parsed', (grayData) => {
Expand Down Expand Up @@ -93,7 +92,7 @@ test('Check same image saved in different modes generate the same buffers in asy
fs.createReadStream(grayscaleGradient)
.pipe(grayPNG)
.on('error', function(error) {
t.fail(`Failed to convert gratscale file: ${error.message}`);
t.fail(`Failed to convert grayscale file: ${error.message}`);
t.end();
})
.on('parsed', (grayData) => {
Expand Down

0 comments on commit 2de9570

Please sign in to comment.