Skip to content

Commit eaafab6

Browse files
committed
test: we only should guarantee non-pooled Uint8Arrays, not non-pooled Buffers
1 parent 6e71db0 commit eaafab6

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

tests/hex.test.js

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -148,23 +148,21 @@ describe('fromHex', () => {
148148
}
149149
})
150150

151-
test('fromHex returns non-pooled buffers', (t) => {
152-
for (const format of [undefined, 'uint8', 'buffer']) {
153-
for (let i = 0; i < 256; i++) {
154-
t.assert.strictEqual(fromHex('aa'.repeat(128), format).buffer.byteLength, 128)
155-
}
151+
test('fromHex returns non-pooled Uint8Array instances', (t) => {
152+
for (let i = 0; i < 256; i++) {
153+
t.assert.strictEqual(fromHex('aa'.repeat(128)).buffer.byteLength, 128)
154+
}
156155

157-
for (let i = 0; i < 256; i++) {
158-
t.assert.strictEqual(fromHex('aa'.repeat(64), format).buffer.byteLength, 64)
159-
}
156+
for (let i = 0; i < 256; i++) {
157+
t.assert.strictEqual(fromHex('aa'.repeat(64)).buffer.byteLength, 64)
158+
}
160159

161-
for (let i = 0; i < 512; i++) {
162-
t.assert.strictEqual(fromHex('aa'.repeat(32), format).buffer.byteLength, 32)
163-
}
160+
for (let i = 0; i < 512; i++) {
161+
t.assert.strictEqual(fromHex('aa'.repeat(32)).buffer.byteLength, 32)
162+
}
164163

165-
for (let i = 0; i < 512; i++) {
166-
t.assert.strictEqual(fromHex('', format).buffer.byteLength, 0)
167-
}
164+
for (let i = 0; i < 512; i++) {
165+
t.assert.strictEqual(fromHex('').buffer.byteLength, 0)
168166
}
169167
})
170168
})

0 commit comments

Comments
 (0)