-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.test.js
More file actions
29 lines (28 loc) · 940 Bytes
/
index.test.js
File metadata and controls
29 lines (28 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const test = require('node:test');
const assert = require('node:assert');
const os = require('node:os');
const platform = os.platform();
const {
computePngChecksum,
computePngChecksums,
} = require(`./pixel-checksum.${platform}.node`);
test.describe('compute_pixels_checksum', () => {
test.it('should return the checksum of the pixels', () => {
const checksum = computePngChecksum('sample.png');
assert.ok(
checksum && typeof checksum === 'string' && checksum.length,
'checksum is not a non-empty string',
);
});
test.it('should return the checksums for an array of images', () => {
const checksums = computePngChecksums(['sample.png']);
assert.ok(
checksums &&
Array.isArray(checksums) &&
checksums.length === 1 &&
typeof checksums[0] === 'string' &&
checksums[0].length,
'checksum is not a single-element array of non-empty strings',
);
});
});