feat(vela): mock push-to-talk transcript updates
This commit is contained in:
@@ -293,8 +293,16 @@ test('websocket handles valid and invalid client messages safely', async () => {
|
||||
type: 'session.state',
|
||||
payload: { value: 'listening' }
|
||||
});
|
||||
assert.deepEqual(await client.nextMessage(), {
|
||||
type: 'transcript.partial',
|
||||
payload: { text: '[mocked partial] Placeholder push-to-talk transcript in progress.' }
|
||||
});
|
||||
|
||||
client.sendJson({ type: 'input_audio.commit', payload: {} });
|
||||
assert.deepEqual(await client.nextMessage(), {
|
||||
type: 'transcript.final',
|
||||
payload: { text: '[mocked final] Placeholder push-to-talk transcript completed from 1 appended chunk.' }
|
||||
});
|
||||
assert.deepEqual(await client.nextMessage(), {
|
||||
type: 'session.state',
|
||||
payload: { value: 'idle' }
|
||||
@@ -340,8 +348,16 @@ test('websocket accepts a placeholder input cycle before a mocked turn on the sa
|
||||
type: 'session.state',
|
||||
payload: { value: 'listening' }
|
||||
});
|
||||
assert.deepEqual(await client.nextMessage(), {
|
||||
type: 'transcript.partial',
|
||||
payload: { text: '[mocked partial] Placeholder push-to-talk transcript in progress.' }
|
||||
});
|
||||
|
||||
client.sendJson({ type: 'input_audio.commit', payload: {} });
|
||||
assert.deepEqual(await client.nextMessage(), {
|
||||
type: 'transcript.final',
|
||||
payload: { text: '[mocked final] Placeholder push-to-talk transcript completed from 1 appended chunk.' }
|
||||
});
|
||||
assert.deepEqual(await client.nextMessage(), {
|
||||
type: 'session.state',
|
||||
payload: { value: 'idle' }
|
||||
@@ -359,6 +375,53 @@ test('websocket accepts a placeholder input cycle before a mocked turn on the sa
|
||||
}
|
||||
});
|
||||
|
||||
test('websocket emits deterministic partials for repeated appends and a deterministic final for commit without append', async () => {
|
||||
const server = await startServer();
|
||||
|
||||
try {
|
||||
const client = await connectWebSocket(server.port);
|
||||
await client.nextMessage();
|
||||
await client.nextMessage();
|
||||
|
||||
client.sendJson({ type: 'input_audio.append', payload: { chunk: 'chunk-1' } });
|
||||
assert.deepEqual(await client.nextMessage(), {
|
||||
type: 'session.state',
|
||||
payload: { value: 'listening' }
|
||||
});
|
||||
assert.deepEqual(await client.nextMessage(), {
|
||||
type: 'transcript.partial',
|
||||
payload: { text: '[mocked partial] Placeholder push-to-talk transcript in progress.' }
|
||||
});
|
||||
|
||||
client.sendJson({ type: 'input_audio.append', payload: { chunk: 'chunk-2' } });
|
||||
assert.deepEqual(await client.nextMessage(), {
|
||||
type: 'transcript.partial',
|
||||
payload: { text: '[mocked partial] Placeholder push-to-talk transcript in progress (2 chunks).' }
|
||||
});
|
||||
|
||||
client.sendJson({ type: 'input_audio.commit', payload: {} });
|
||||
assert.deepEqual(await client.nextMessage(), {
|
||||
type: 'transcript.final',
|
||||
payload: { text: '[mocked final] Placeholder push-to-talk transcript completed from 2 appended chunks.' }
|
||||
});
|
||||
assert.deepEqual(await client.nextMessage(), {
|
||||
type: 'session.state',
|
||||
payload: { value: 'idle' }
|
||||
});
|
||||
|
||||
client.sendJson({ type: 'input_audio.commit', payload: {} });
|
||||
assert.deepEqual(await client.nextMessage(), {
|
||||
type: 'transcript.final',
|
||||
payload: { text: '[mocked final] Placeholder push-to-talk transcript completed without appended audio.' }
|
||||
});
|
||||
await assert.rejects(() => client.nextMessage(150), /timed out waiting for websocket message/);
|
||||
|
||||
await client.close();
|
||||
} finally {
|
||||
await server.close();
|
||||
}
|
||||
});
|
||||
|
||||
test('websocket mocked turn emits deterministic transcript and response events in order', async () => {
|
||||
const server = await startServer();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user