bennc-js/tests/messages/subscribe.test.ts
Jack Hadrill 5c17b880cf
All checks were successful
continuous-integration/drone/push Build is passing
Remove buffer dependency
2022-02-22 22:35:55 +00:00

15 lines
426 B
TypeScript

import { MessageTypes } from '../../src/common'
import { packers } from '../../src/mapping'
test('Create a subscribe (0x0000) packet.', () => {
// Given
const messageType = 0xabcd
// When
const packedPacket = packers[MessageTypes.Subscribe]({ messageType: messageType })
// Then
const expectedResult = new Uint8Array([0x00, 0x00, 0x00, 0x02, 0xab, 0xcd])
expect(packedPacket).toMatchObject(expectedResult)
})