diff --git a/test/metadata.js b/test/metadata.js new file mode 100644 index 0000000..36d884b --- /dev/null +++ b/test/metadata.js @@ -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(); + }); +}); diff --git a/test/same_img_different_format-spec.js b/test/same_img_different_format-spec.js index f37c6c2..2545b89 100644 --- a/test/same_img_different_format-spec.js +++ b/test/same_img_different_format-spec.js @@ -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); @@ -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) => { @@ -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) => {