refactor(present): restore existing conversation coordinate handling
This commit is contained in:
1 parent
207dce0bee
commit
cd2b9ca04a
2 files changed
+6
-4
No files matched your search
@@ -137,9 +137,7 @@ const SESSION_LOCATION = { kind: 'session' } as const
|
||||
const UNRESOLVED_LOCATION = { kind: 'unresolved' } as const
|
||||
|
||||
function payloadCoordinates(event: SessionEventLike): Coordinates {
|
||||
const payload: unknown = event.data
|
||||
if (typeof payload !== 'object' || payload === null || Array.isArray(payload)) return {}
|
||||
const data = payload as { turn?: unknown; step?: unknown }
|
||||
const data = event.data as unknown as { turn?: unknown; step?: unknown }
|
||||
if (data.turn === null) return { session: true }
|
||||
const turn = Number.isSafeInteger(data.turn) && (data.turn as number) >= 0
|
||||
? data.turn as number
|
||||
|
||||
@@ -600,7 +600,11 @@ describe('presented files', () => {
|
||||
})
|
||||
|
||||
|
||||
it.each([null, [], 'invalid', {}, { turn: '1', callId: 'bad', files: [] },
|
||||
it.each([null, [], 'invalid'])('declines non-object delivery data: %j', (data) => {
|
||||
expect(deliverablesDefinition.match(at(1, 'deliverables/presented', data))).toBeNull()
|
||||
})
|
||||
|
||||
it.each([{}, { turn: '1', callId: 'bad', files: [] },
|
||||
{ turn: 1.5, callId: 'bad', files: [] }, { turn: 0, callId: 'bad', files: [] },
|
||||
{ turn: 1, files: [] }, { turn: 1, callId: '', files: [] }, { turn: 1, callId: 'bad', files: null },
|
||||
])('ignores malformed delivery data and keeps the existing produced row: %j', (data) => {
|
||||
|
||||
Reference in new issue
Block a user