mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 16:02:32 +00:00
16 lines
539 B
TypeScript
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
|
|
})
|
|
})
|
|
})
|