diff --git a/test/node/test-buffer-badhex.js b/test/node/test-buffer-badhex.js index 486e166..90c302f 100644 --- a/test/node/test-buffer-badhex.js +++ b/test/node/test-buffer-badhex.js @@ -17,9 +17,11 @@ const assert = require('assert'); // Node Buffer behavior check // > Buffer.from('abc def01','hex') // + assert.strictEqual(buf.write('00000000', 0, 'hex'), 4); assert.strictEqual(buf.write('abc def01', 0, 'hex'), 1); - assert.deepStrictEqual(buf, new Buffer([0xab])); - assert.strictEqual(buf.toString('hex'), 'ab'); + assert.deepStrictEqual(buf, new Buffer([0xab, 0, 0, 0])); + assert.strictEqual(buf.toString('hex'), 'ab000000'); + assert.deepStrictEqual(Buffer.from('abc def01', 'hex'), Buffer.from([0xab])); const copy = Buffer.from(buf.toString('hex'), 'hex'); assert.strictEqual(buf.toString('hex'), copy.toString('hex')); @@ -53,4 +55,3 @@ const assert = require('assert'); const badHex = `${hex.slice(0, 256)}xx${hex.slice(256, 510)}`; assert.deepStrictEqual(Buffer.from(badHex, 'hex'), buf.slice(0, 128)); } -