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:
William Swanson
2019-08-29 17:54:42 -07:00
parent 67d00491eb
commit 0a55ba64fa
4 changed files with 8 additions and 11 deletions

View File

@@ -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]));
});
});
});