Files
orca/src/shared/emulator-touch-frame.test.ts
T
2026-06-08 00:08:57 -07:00

16 lines
539 B
TypeScript

import { describe, expect, it } from 'vitest'
import { encodeServeSimTouchFrame, SERVE_SIM_TOUCH_MESSAGE_TAG } from './emulator-touch-frame'
describe('encodeServeSimTouchFrame', () => {
it('encodes serve-sim touch messages with the binary touch tag', () => {
const frame = encodeServeSimTouchFrame({ type: 'move', x: 0.25, y: 0.75 })
expect(frame[0]).toBe(SERVE_SIM_TOUCH_MESSAGE_TAG)
expect(JSON.parse(new TextDecoder().decode(frame.subarray(1)))).toEqual({
type: 'move',
x: 0.25,
y: 0.75
})
})
})