test(fallback): type chat output assertions
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -10,6 +10,10 @@ import { unsafeTestValue } from "../../test-support/unsafe-test-value"
|
|||||||
|
|
||||||
type EventInput = { event: { type: string; properties?: unknown } }
|
type EventInput = { event: { type: string; properties?: unknown } }
|
||||||
type EventHandlerInput = Parameters<ReturnType<typeof createEventHandler>>[0]
|
type EventHandlerInput = Parameters<ReturnType<typeof createEventHandler>>[0]
|
||||||
|
type ChatMessageOutput = {
|
||||||
|
message: Record<string, unknown>
|
||||||
|
parts: Array<{ type: string; text?: string }>
|
||||||
|
}
|
||||||
|
|
||||||
function asEventHandlerInput(input: EventInput): EventHandlerInput {
|
function asEventHandlerInput(input: EventInput): EventHandlerInput {
|
||||||
return unsafeTestValue<EventHandlerInput>(input)
|
return unsafeTestValue<EventHandlerInput>(input)
|
||||||
@@ -432,7 +436,7 @@ describe("createEventHandler - model fallback", () => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const output = { message: {}, parts: [] as Array<{ type: string; text?: string }> }
|
const output: ChatMessageOutput = { message: {}, parts: [] }
|
||||||
await chatMessageHandler(
|
await chatMessageHandler(
|
||||||
{
|
{
|
||||||
sessionID,
|
sessionID,
|
||||||
@@ -568,7 +572,7 @@ describe("createEventHandler - model fallback", () => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const output = { message: {}, parts: [] as Array<{ type: string; text?: string }> }
|
const output: ChatMessageOutput = { message: {}, parts: [] }
|
||||||
await chatMessageHandler(
|
await chatMessageHandler(
|
||||||
{
|
{
|
||||||
sessionID,
|
sessionID,
|
||||||
@@ -733,7 +737,7 @@ describe("createEventHandler - model fallback", () => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const output = { message: {}, parts: [] as Array<{ type: string; text?: string }> }
|
const output: ChatMessageOutput = { message: {}, parts: [] }
|
||||||
await chatMessageHandler(
|
await chatMessageHandler(
|
||||||
{
|
{
|
||||||
sessionID,
|
sessionID,
|
||||||
@@ -847,7 +851,7 @@ describe("createEventHandler - model fallback", () => {
|
|||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const output = { message: {}, parts: [] as Array<{ type: string; text?: string }> }
|
const output: ChatMessageOutput = { message: {}, parts: [] }
|
||||||
await chatMessageHandler(
|
await chatMessageHandler(
|
||||||
{
|
{
|
||||||
sessionID,
|
sessionID,
|
||||||
|
|||||||
Reference in New Issue
Block a user