fix(javascript): preserve recovery acquisition and cancellation failures

This commit is contained in:
morluto
2026-10-24 03:04:11 +08:00
parent cb689fae96
commit e00b2eda0b
11 changed files with 191 additions and 33 deletions
@@ -123,11 +123,14 @@ describe("JavaScript recovery workflow", () => {
const invalid = await service.recover({});
if (invalid.ok) throw new Error("expected malformed input");
expect(invalid.error._tag).toBe("AnalysisInputError");
const cancelled = await service.recover(input, {
signal: AbortSignal.abort(),
});
if (cancelled.ok) throw new Error("expected cancellation");
expect(cancelled.error._tag).toBe("AnalysisCancelledError");
for (const reason of [null, false, { request: "cancel recovery" }]) {
const cancelled = await service.recover(input, {
signal: AbortSignal.abort(reason),
});
if (cancelled.ok) throw new Error("expected cancellation");
expect(cancelled.error._tag).toBe("AnalysisCancelledError");
expect(cancelled.error.cause).toBe(reason);
}
});
it("rejects additional_paths repeating path or each other", async () => {
const service = new JavaScriptRecoveryService({