test(hooks): remove unsafe test 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:
@@ -11,6 +11,10 @@ type ClientWithPromptAsync = {
|
||||
}
|
||||
}
|
||||
|
||||
function hasPromptAsync(client: Client): client is Client & ClientWithPromptAsync {
|
||||
return "promptAsync" in client.session && typeof client.session.promptAsync === "function"
|
||||
}
|
||||
|
||||
|
||||
interface ToolUsePart {
|
||||
type: "tool_use"
|
||||
@@ -111,7 +115,11 @@ export async function recoverToolResultMissing(
|
||||
}
|
||||
|
||||
try {
|
||||
await (client as unknown as ClientWithPromptAsync).session.promptAsync(promptInput)
|
||||
if (!hasPromptAsync(client)) {
|
||||
return false
|
||||
}
|
||||
|
||||
await client.session.promptAsync(promptInput)
|
||||
|
||||
return true
|
||||
} catch {
|
||||
|
||||
@@ -13,7 +13,7 @@ function createMockClient(handlers: {
|
||||
messages?: (sessionID: string) => unknown[]
|
||||
message?: (sessionID: string, messageID: string) => unknown
|
||||
}) {
|
||||
return {
|
||||
return testCoerce({
|
||||
session: {
|
||||
messages: async (opts: { path: { id: string } }) => {
|
||||
if (handlers.messages) {
|
||||
@@ -28,7 +28,7 @@ function createMockClient(handlers: {
|
||||
throw new Error("not implemented")
|
||||
},
|
||||
},
|
||||
} as unknown
|
||||
})
|
||||
}
|
||||
|
||||
describe("session-recovery storage SDK readers", () => {
|
||||
|
||||
Reference in New Issue
Block a user