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:
YeonGyu-Kim
2026-05-12 14:22:05 +09:00
parent 11b3638493
commit 23211159c9
37 changed files with 242 additions and 232 deletions
+2 -2
View File
@@ -74,7 +74,7 @@ done
const originalSetTimeout = globalThis.setTimeout
globalThis.setTimeout = ((fn: (...args: unknown[]) => void, _ms?: number) => {
fn()
return 0 as unknown as ReturnType<typeof setTimeout>
return testCoerce<ReturnType<typeof setTimeout>>(0)
}) as typeof setTimeout
try {
@@ -102,7 +102,7 @@ done
const originalSetTimeout = globalThis.setTimeout
globalThis.setTimeout = ((fn: (...args: unknown[]) => void, _ms?: number) => {
fn()
return 0 as unknown as ReturnType<typeof setTimeout>
return testCoerce<ReturnType<typeof setTimeout>>(0)
}) as typeof setTimeout
try {
+11 -11
View File
@@ -7,18 +7,18 @@ describe("pending-calls cleanup interval", () => {
const setIntervalCalls: number[] = []
let unrefCalled = 0
globalThis.setInterval = ((
globalThis.setInterval = testCoerce<typeof setInterval>(((
_handler: TimerHandler,
timeout?: number,
..._args: any[]
..._args: unknown[]
) => {
setIntervalCalls.push(timeout as number)
return {
return testCoerce<ReturnType<typeof setInterval>>({
unref: () => {
unrefCalled += 1
},
} as unknown as ReturnType<typeof setInterval>
}) as unknown as typeof setInterval
})
}))
try {
const modulePath = new URL("./pending-calls.ts", import.meta.url).pathname
@@ -43,20 +43,20 @@ describe("pending-calls cleanup interval", () => {
let intervalHandle: ReturnType<typeof setInterval> | undefined
let clearCalls = 0
globalThis.setInterval = ((
globalThis.setInterval = testCoerce<typeof setInterval>(((
_handler: TimerHandler,
_timeout?: number,
..._args: any[]
..._args: unknown[]
) => {
intervalHandle = { unref: () => {} } as unknown as ReturnType<typeof setInterval>
intervalHandle = testCoerce<ReturnType<typeof setInterval>>({ unref: () => {} })
return intervalHandle
}) as unknown as typeof setInterval
}))
globalThis.clearInterval = ((handle?: ReturnType<typeof setInterval>) => {
globalThis.clearInterval = testCoerce<typeof clearInterval>(((handle?: ReturnType<typeof setInterval>) => {
if (handle === intervalHandle) {
clearCalls += 1
}
}) as unknown as typeof clearInterval
}))
try {
const modulePath = new URL("./pending-calls.ts", import.meta.url).pathname