test(environment): consolidate create-call reference coverage (#11978)

This commit is contained in:
morluto authored and GitHub committed 2026-11-18 12:32:39 +08:00
1 parent 9aaab112f1
commit 62932f9919
1 file changed
+6 -20
@@ -6,7 +6,6 @@ import {
} from "../../../tests/fixtures/analysisView.js";
import {
HELD_FIXED_TAG_ROWS,
TAG_ROWS,
misshelvedRows,
referencedCreateRows,
shelvedRows,
@@ -63,11 +62,7 @@ describe("create plans learned from every call", () => {
});
});
it.each([
{ id: 1, name: "Different Hall", floor: "ground" },
{ id: 2, name: "Map Room", floor: "upper" },
null,
])(
it.each([{ id: 2, name: "Map Room", floor: "upper" }, null])(
"withholds a create whose sent reference contradicts its answer (%j)",
(shelf) => {
expect(createPlan(referencedCreateRows(shelf))).toMatchObject({
@@ -86,7 +81,6 @@ describe("create plans learned from every call", () => {
});
it("trims no clock a later create shows trimmed after a held entity showed it at a fixed width", () => {
expect(createPlan(TAG_ROWS, "post_tags")).toMatchObject({ served: true });
const plan = createPlan(HELD_FIXED_TAG_ROWS, "post_tags");
expect(plan).toMatchObject({ served: false, reason: "unexplained-change" });
expect(plan.rules).not.toContainEqual(
@@ -175,24 +169,16 @@ describe("merging a later create into a plan", () => {
});
const unshelvedExemplar = { id: 3, name: "Third" };
it("takes a reference one call alone shows when the other did not send its member", () => {
const merged = mergedCreatePlan(
plan,
unshelvedExemplar,
shelved(4, "Fourth"),
);
expect(merged).toMatchObject({
rules: expect.arrayContaining([reference]),
body: { accepted: ["name", "shelf_id"], required: ["name"] },
});
});
it("keeps a reference an earlier call added through calls that leave it out, and agrees with it when it returns", () => {
it("adds an optional reference and keeps it through later omission and return", () => {
const added = mergedCreatePlan(
plan,
unshelvedExemplar,
shelved(4, "Fourth"),
)!;
expect(added).toMatchObject({
rules: expect.arrayContaining([reference]),
body: { accepted: ["name", "shelf_id"], required: ["name"] },
});
const omitted = mergedCreatePlan(
added,
unshelvedExemplar,