15 lines
428 B
TypeScript
15 lines
428 B
TypeScript
|
import { MessageTypes } from '../../src/common'
|
||
|
import { packers } from '../../src/mapping'
|
||
|
|
||
|
test('Create an unsubscribe (0xffff) packet.', () => {
|
||
|
// Given
|
||
|
const messageType = 0xabcd
|
||
|
|
||
|
// When
|
||
|
const packedPacket = packers[MessageTypes.Unsubscribe]({ messageType: messageType })
|
||
|
|
||
|
// Then
|
||
|
const expectedResult = Buffer.from([0xff, 0xff, 0x00, 0x02, 0xab, 0xcd])
|
||
|
expect(packedPacket).toMatchObject(expectedResult)
|
||
|
})
|