Skip to content

Commit

Permalink
making sure lib works with old js implementation (just in case)
Browse files Browse the repository at this point in the history
  • Loading branch information
catdad committed Nov 8, 2023
1 parent f9ba8ab commit 9d8d844
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,22 @@ const { PNG } = require('pngjs');
const toUint8 = require('buffer-to-uint8array');
const pixelmatch = require('pixelmatch');

const decode = require('../');

const readFile = promisify(fs.readFile);

describe('heic-decode', () => {
describe('heic-decode (default wasm bundle)', () => {
runTests(require(root));
});

describe('heic-decode (js)', () => {
const libheif = require('libheif-js');
const { one, all } = require('../lib')(libheif);
const decode = one;
decode.all = all;

runTests(decode);
});

function runTests(decode) {
const readControl = async name => {
const buffer = await readFile(path.resolve(root, `temp/${name}`));
const { data, width, height } = PNG.sync.read(buffer);
Expand Down Expand Up @@ -85,4 +96,4 @@ describe('heic-decode', () => {
.and.to.have.property('message', 'input buffer is not a HEIC image');
}
});
});
}

0 comments on commit 9d8d844

Please sign in to comment.