mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-22 21:25:49 +00:00
Fix node 12 compatibility (#33)
The unit tests were comparing things of different types, which failed under the stricter checks.
This commit is contained in:
@@ -12,12 +12,12 @@ describe('bytes-utils', function() {
|
||||
it('can decode hex to a Uint8Array', function() {
|
||||
const result = parseBytes('0012', Uint8Array);
|
||||
assert(result instanceof Uint8Array);
|
||||
assert.deepEqual(result, [0x00, 0x12]);
|
||||
assert.deepEqual(result, Uint8Array.from([0x00, 0x12]));
|
||||
});
|
||||
it('can convert a list to a Uint8Array', function() {
|
||||
const result = parseBytes([0x00, 0x12], Uint8Array);
|
||||
assert(result instanceof Uint8Array);
|
||||
assert.deepEqual(result, [0x00, 0x12]);
|
||||
assert.deepEqual(result, Uint8Array.from([0x00, 0x12]));
|
||||
});
|
||||
it('can decode hex to a Buffer', function() {
|
||||
const result = parseBytes('0012', Buffer);
|
||||
@@ -66,7 +66,7 @@ describe('bytes-utils', function() {
|
||||
});
|
||||
it('the 4th arg is the output class type', function() {
|
||||
assert.deepEqual(slice(val, 2, 4, Buffer).toJSON().data, [3, 4]);
|
||||
assert.deepEqual(slice(val, 2, 4, Uint8Array), [3, 4]);
|
||||
assert.deepEqual(slice(val, 2, 4, Uint8Array), Uint8Array.from([3, 4]));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user