test(experiment): checkpoint explicit-node formulation
This commit is contained in:
@@ -0,0 +1,43 @@
|
|||||||
|
import { describe, expect, it } from "vitest";
|
||||||
|
|
||||||
|
import fixture from "@/tests/fixtures/live-product-launch-update-response.json";
|
||||||
|
import { formulateQuestion } from "@/lib/graph/question-formulator.js";
|
||||||
|
|
||||||
|
describe("RTO.A5 explicit-node formulation apparatus", () => {
|
||||||
|
it("formulates directly for nxmeiab without selector invocation or graph mutation", () => {
|
||||||
|
const graph = structuredClone(fixture.updatedSituationGraph);
|
||||||
|
const graphBefore = structuredClone(graph);
|
||||||
|
const capturedSelectedQuestionNodeIdBefore = fixture.selectedQuestion.nodeId;
|
||||||
|
const activeUnknownNodeIdBefore = graph.activeUnknownNodeId ?? null;
|
||||||
|
const resolvedNodeIdsBefore = structuredClone(graph.resolvedNodeIds || []);
|
||||||
|
|
||||||
|
const target = graph.nodes.find((node) => node.id === "nxmeiab");
|
||||||
|
|
||||||
|
expect(target).toBeTruthy();
|
||||||
|
expect(target?.kind).toBe("unknown");
|
||||||
|
expect(target?.status).not.toBe("resolved");
|
||||||
|
|
||||||
|
const result = formulateQuestion({
|
||||||
|
node: target,
|
||||||
|
graph,
|
||||||
|
context: {
|
||||||
|
selectionState: {
|
||||||
|
status: "selected",
|
||||||
|
nodeId: "nxmeiab",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(result).toBeTruthy();
|
||||||
|
expect(typeof result.question).toBe("string");
|
||||||
|
expect(result.question.length).toBeGreaterThan(0);
|
||||||
|
expect(result.question.toLowerCase()).toMatch(
|
||||||
|
/competitor|competitors|similar products|release/,
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(fixture.selectedQuestion.nodeId).toBe(capturedSelectedQuestionNodeIdBefore);
|
||||||
|
expect(graph.activeUnknownNodeId ?? null).toBe(activeUnknownNodeIdBefore);
|
||||||
|
expect(graph.resolvedNodeIds || []).toEqual(resolvedNodeIdsBefore);
|
||||||
|
expect(graph).toEqual(graphBefore);
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user