test(desktop): reuse archive draft checks

This commit is contained in:
Vincent Koc
2026-12-03 01:35:56 +08:00
parent 5000433e44
commit 3b3ecfbe6f
+6 -25
View File
@@ -1,7 +1,6 @@
import { describe, expect, it } from "vitest";
import type { JsonValue } from "../jsonValue.js";
import { evaluateTaskChecks } from "./appTaskChecks.js";
import {
draftOf,
passing,
@@ -816,18 +815,8 @@ it("keeps an added ID-only member when another XML archive entry independently a
const checks = (drafted?.suggested ?? []).filter(
(check) => "pointer" in check && check.pointer.includes("[name=other.xml]"),
);
expect(
evaluateTaskChecks(
checks.map((check, index) => ({ ...check, id: `c${index}` })),
new Map([[file, { format: "zip", view: archive(false) }]]),
).map(({ passed }) => passed),
).toContain(false);
expect(
evaluateTaskChecks(
checks.map((check, index) => ({ ...check, id: `c${index}` })),
new Map([[file, { format: "zip", view: archive(true) }]]),
).every(({ passed }) => passed),
).toBe(true);
expect(passing(file, archive(false), checks, "zip")).toContain(false);
expect(passing(file, archive(true), checks, "zip").every(Boolean)).toBe(true);
});
it("keeps changed display text when its matching label belongs to another XML archive entry", () => {
@@ -870,16 +859,8 @@ it("keeps changed display text when its matching label belongs to another XML ar
(check) =>
"pointer" in check && check.pointer.includes("[name=display.xml]"),
);
expect(
evaluateTaskChecks(
checks.map((check, index) => ({ ...check, id: `c${index}` })),
new Map([[file, { format: "zip", view: archive("Old") }]]),
).map(({ passed }) => passed),
).toContain(false);
expect(
evaluateTaskChecks(
checks.map((check, index) => ({ ...check, id: `c${index}` })),
new Map([[file, { format: "zip", view: archive("New") }]]),
).every(({ passed }) => passed),
).toBe(true);
expect(passing(file, archive("Old"), checks, "zip")).toContain(false);
expect(passing(file, archive("New"), checks, "zip").every(Boolean)).toBe(
true,
);
});