Skip to content

Commit

Permalink
Fix failing tests for #303 (unreleased) (#341)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinusU committed Jan 23, 2024
1 parent 3404b7e commit cbd0ceb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/node/test-buffer-badhex.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ const assert = require('assert');
// Node Buffer behavior check
// > Buffer.from('abc def01','hex')
// <Buffer ab>
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'));
Expand Down Expand Up @@ -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));
}

0 comments on commit cbd0ceb

Please sign in to comment.