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:
@@ -738,7 +738,7 @@ You are starting a Sisyphus work session.
|
||||
const promptAsyncMock = spyOn({
|
||||
promptAsync: async (_request: unknown) => undefined,
|
||||
}, "promptAsync")
|
||||
const ctx = {
|
||||
const ctx = testCoerce<Parameters<typeof createAtlasHook>[0]>({
|
||||
directory: testDir,
|
||||
client: {
|
||||
session: {
|
||||
@@ -747,7 +747,7 @@ You are starting a Sisyphus work session.
|
||||
messages: async () => ({ data: [] }),
|
||||
},
|
||||
},
|
||||
} as unknown as Parameters<typeof createAtlasHook>[0]
|
||||
})
|
||||
const startWorkHook = createStartWorkHook(ctx)
|
||||
const atlasHook = createAtlasHook(ctx)
|
||||
const output = {
|
||||
@@ -784,18 +784,18 @@ You are starting a Sisyphus work session.
|
||||
promptAsync: async (_request: unknown) => undefined,
|
||||
}, "promptAsync")
|
||||
|
||||
globalThis.setTimeout = ((callback: Function, delay?: number, ...args: unknown[]) => {
|
||||
globalThis.setTimeout = testCoerce<typeof setTimeout>(((callback: Function, delay?: number, ...args: unknown[]) => {
|
||||
const normalized = typeof delay === "number" ? delay : 0
|
||||
if (normalized >= 5000) {
|
||||
const id = nextTimerId++
|
||||
capturedTimers.set(id, { callback: () => callback(...args), cleared: false })
|
||||
return id as unknown as ReturnType<typeof setTimeout>
|
||||
return testCoerce<ReturnType<typeof setTimeout>>(id)
|
||||
}
|
||||
|
||||
return originalSetTimeout(callback as Parameters<typeof originalSetTimeout>[0], delay)
|
||||
}) as unknown as typeof setTimeout
|
||||
}))
|
||||
|
||||
globalThis.clearTimeout = ((id?: number | ReturnType<typeof setTimeout>) => {
|
||||
globalThis.clearTimeout = testCoerce<typeof clearTimeout>(((id?: number | ReturnType<typeof setTimeout>) => {
|
||||
if (typeof id === "number" && capturedTimers.has(id)) {
|
||||
capturedTimers.get(id)!.cleared = true
|
||||
capturedTimers.delete(id)
|
||||
@@ -803,11 +803,11 @@ You are starting a Sisyphus work session.
|
||||
}
|
||||
|
||||
originalClearTimeout(id as Parameters<typeof originalClearTimeout>[0])
|
||||
}) as unknown as typeof clearTimeout
|
||||
}))
|
||||
|
||||
Date.now = () => fakeNow
|
||||
|
||||
const ctx = {
|
||||
const ctx = testCoerce<Parameters<typeof createAtlasHook>[0]>({
|
||||
directory: testDir,
|
||||
client: {
|
||||
session: {
|
||||
@@ -816,13 +816,13 @@ You are starting a Sisyphus work session.
|
||||
messages: async () => ({ data: [] }),
|
||||
},
|
||||
},
|
||||
} as unknown as Parameters<typeof createAtlasHook>[0]
|
||||
})
|
||||
const startWorkHook = createStartWorkHook(ctx)
|
||||
const atlasHook = createAtlasHook(ctx, {
|
||||
directory: testDir,
|
||||
backgroundManager: {
|
||||
backgroundManager: testCoerce<NonNullable<Parameters<typeof createAtlasHook>[1]>["backgroundManager"]>({
|
||||
getTasksByParentSession: () => backgroundRunning ? [{ status: "running" }] : [],
|
||||
} as unknown as NonNullable<Parameters<typeof createAtlasHook>[1]>["backgroundManager"],
|
||||
}),
|
||||
})
|
||||
const output = {
|
||||
message: {} as Record<string, unknown>,
|
||||
|
||||
Reference in New Issue
Block a user