Skip to content
File

Blob: worker/tests/runtime/rpc.test.ts

typescript18 lines
1import { expect, test } from 'vitest';
2import { createHarness, offer } from './harness.ts';
3 
4test('typed RPC preserves startup identity across eviction and returns expected errors as data', async () => {
5 const h = createHarness();
6 const input = { bootId: 'a'.repeat(32), sessionDescription: offer };
7 const first = await h.room.startDevice(input);
8 expect(first.ok).toBe(true);
9 expect(h.calls).toHaveLength(2);
10 await h.evict();
11 expect(await h.room.startDevice(input)).toEqual(first);
12 expect(h.calls).toHaveLength(2);
13 expect(await h.room.deviceHeartbeat('stale-generation')).toMatchObject({
14 ok: false,
15 status: 409,
16 });
17});