mirror of
https://github.com/morluto/rea.git
synced 2026-11-14 10:43:30 +00:00
fix(views): honor cancellation before admission
This commit is contained in:
1 parent
e7f29f8b8f
commit
3431541073
2 files changed
+38
No files matched your search
@@ -42,6 +42,43 @@ import {
|
||||
} from "../../../tests/fixtures/browserScenarioCapture.js";
|
||||
import { projectAnalysisError } from "../../domain/analysisErrorProjection.js";
|
||||
|
||||
it.each(["inline", "retained-evidence", "invalid"] as const)(
|
||||
"refuses an already cancelled %s view before source admission",
|
||||
async (kind) => {
|
||||
const parent = analysisViewLayoutEvidence();
|
||||
const ledger = new EvidenceLedger();
|
||||
expect(ledger.record(parent).ok).toBe(true);
|
||||
const retained = ledger.forAnalysis(parent.evidence_id);
|
||||
let lookups = 0;
|
||||
const controller = new AbortController();
|
||||
const reason = Object.freeze({ requested: "cancel-before-view-admission" });
|
||||
controller.abort(reason);
|
||||
const result = await inspectAnalysisView(
|
||||
kind === "invalid"
|
||||
? null
|
||||
: {
|
||||
source:
|
||||
kind === "inline"
|
||||
? { kind, evidence: parent }
|
||||
: { kind, evidence_id: parent.evidence_id },
|
||||
view: { kind: "summary" },
|
||||
},
|
||||
(id) => {
|
||||
lookups++;
|
||||
return ledger.forAnalysis(id);
|
||||
},
|
||||
{ signal: controller.signal },
|
||||
);
|
||||
expect(result).toMatchObject({
|
||||
ok: false,
|
||||
error: { _tag: "AnalysisCancelledError" },
|
||||
});
|
||||
expect(result.ok ? undefined : result.error.cause).toBe(reason);
|
||||
expect(lookups).toBe(0);
|
||||
expect(ledger.forAnalysis(parent.evidence_id)).toBe(retained);
|
||||
},
|
||||
);
|
||||
|
||||
it.each([false, true])(
|
||||
"summarizes the selected observation path rather than older retained display metadata (history=%s)",
|
||||
(history) => {
|
||||
|
||||
Reference in new issue
Block a user