Skip to content

Commit 4946ecb

Browse files
committed
test: 💍 verify Buffer is supported in MessagePack codec
1 parent 5b27852 commit 4946ecb

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/msgpack/__tests__/MsgPackEncoder.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ describe('binary', () => {
1818
});
1919
});
2020

21+
describe('Buffer', () => {
22+
test('supports Buffer instances', () => {
23+
const data = {foo: Buffer.from([3, 2, 1])};
24+
const encoded = encode(data);
25+
const decoded = decode(encoded);
26+
expect(decoded).toStrictEqual({foo: new Uint8Array([3, 2, 1])});
27+
});
28+
});
29+
2130
describe('extensions', () => {
2231
test('can encode a 5 byte extension', () => {
2332
const ext = new JsonPackExtension(33, new Uint8Array([1, 2, 3, 4, 5]));

0 commit comments

Comments
 (0)