fix(test): widen capturedHandler cast to resolve TS2349 never narrowing (FAR-40)

TypeScript CFA does not trace the assignment inside the vi.spyOn
mockImplementation callback, so it narrows capturedHandler to null at
the if-check, making the body unreachable (never). Cast at the call
site breaks the false narrowing without changing runtime behaviour.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2026-04-25 00:31:27 +00:00
parent d858df7cf2
commit 38ed261063
+1 -1
View File
@@ -357,7 +357,7 @@ describe("execute — SIGTERM handler", () => {
if (capturedHandler) {
const batchApi = vi.mocked(getBatchApi)();
// Fire the handler and verify it deletes the job that was just created.
try { capturedHandler(); } catch { /* swallow process.exit throw */ }
try { (capturedHandler as () => void)(); } catch { /* swallow process.exit throw */ }
await new Promise((r) => setTimeout(r, 50)); // let async handler tick
expect(batchApi.deleteNamespacedJob).toHaveBeenCalled();
}