Skip to content

Commit

Permalink
test: 💍 verify Buffer is supported in MessagePack codec
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Aug 7, 2024
1 parent 5b27852 commit 4946ecb
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/msgpack/__tests__/MsgPackEncoder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ describe('binary', () => {
});
});

describe('Buffer', () => {
test('supports Buffer instances', () => {
const data = {foo: Buffer.from([3, 2, 1])};
const encoded = encode(data);
const decoded = decode(encoded);
expect(decoded).toStrictEqual({foo: new Uint8Array([3, 2, 1])});
});
});

describe('extensions', () => {
test('can encode a 5 byte extension', () => {
const ext = new JsonPackExtension(33, new Uint8Array([1, 2, 3, 4, 5]));
Expand Down

0 comments on commit 4946ecb

Please sign in to comment.