Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

Commit

Permalink
Add integration test for multiple outputs
Browse files Browse the repository at this point in the history
- Add 48x48 reference images
- Add integration test for a webpack build with multiple outputs
  • Loading branch information
jarrodldavis committed Feb 9, 2019
1 parent cdd3471 commit 397c31e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ const {

const OUTPUT_FORMAT = 'png';

const REFERENCE_PATH_48 = path.join(__dirname, './reference-images/stroke-and-fill-48.png');
const OUTPUT_PATH_48 = 'images/icon-48.png';
const OUTPUT_WIDTH_48 = 48;
const OUTPUT_HEIGHT_48 = 48;

const REFERENCE_PATH_96 = path.join(__dirname, './reference-images/stroke-and-fill-96.png');
const OUTPUT_PATH_96 = 'images/icon-96.png';
const OUTPUT_WIDTH_96 = 96;
Expand Down Expand Up @@ -87,4 +92,24 @@ describe('integration', function() {
outputfs.should.have.file(path.join(config.output.path, OUTPUT_PATH_96))
.which.pixelmatches(reference);
});

it('emits multiple output files', async function() {
const reference48 = await readFile(REFERENCE_PATH_48);
const reference96 = await readFile(REFERENCE_PATH_96);

config.plugins.push(
new RasterizeSvgPathWebpackPlugin(INPUT_PATH, INPUT_WIDTH, INPUT_HEIGHT, STROKE_COLOR, FILL_COLOR, [
{ filePath: OUTPUT_PATH_48, format: OUTPUT_FORMAT, width: OUTPUT_WIDTH_48, height: OUTPUT_HEIGHT_48 },
{ filePath: OUTPUT_PATH_96, format: OUTPUT_FORMAT, width: OUTPUT_WIDTH_96, height: OUTPUT_HEIGHT_96 }
])
);

await run();

outputfs.should.have.file(path.join(config.output.path, OUTPUT_PATH_48))
.which.pixelmatches(reference48);

outputfs.should.have.file(path.join(config.output.path, OUTPUT_PATH_96))
.which.pixelmatches(reference96);
});
});
Binary file added test/reference-images/fill-only-48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/reference-images/stroke-and-fill-48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/reference-images/stroke-only-48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 397c31e

Please sign in to comment.