Skip to content

Commit

Permalink
Tests: reduce flakiness of withIccProfile warning check
Browse files Browse the repository at this point in the history
  • Loading branch information
lovell committed Jul 24, 2024
1 parent 7fbb988 commit f7ed9b7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/unit/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -641,13 +641,13 @@ describe('Image metadata', function () {
.png()
.withIccProfile(fixtures.path('invalid-illuminant.icc'));

let warningEmitted = '';
const warningsEmitted = [];
img.on('warning', (warning) => {
warningEmitted = warning;
warningsEmitted.push(warning);
});

const data = await img.toBuffer();
assert.strictEqual('Invalid profile', warningEmitted);
assert.strict(warningsEmitted.includes('Invalid profile'));

const metadata = await sharp(data).metadata();
assert.strictEqual(3, metadata.channels);
Expand Down

0 comments on commit f7ed9b7

Please sign in to comment.