Complete V1 RC deployment capability gates
This commit is contained in:
44
web/tests/unit/v1-acceptance.test.mjs
Normal file
44
web/tests/unit/v1-acceptance.test.mjs
Normal file
@@ -0,0 +1,44 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { buildAcceptancePlan, readAcceptanceInputs } from "../../../tools/web/v1-acceptance-lib.mjs";
|
||||
|
||||
const inputs = readAcceptanceInputs();
|
||||
|
||||
function clonedInputs() {
|
||||
return {
|
||||
ledger: structuredClone(inputs.ledger),
|
||||
packageManifest: structuredClone(inputs.packageManifest),
|
||||
};
|
||||
}
|
||||
|
||||
test("V1 acceptance declarations resolve to executable Web commands", () => {
|
||||
const plan = buildAcceptancePlan(inputs.ledger, inputs.packageManifest);
|
||||
assert.deepEqual(
|
||||
{ families: plan.familyCount, declarations: plan.declarationCount, unique: plan.uniqueCount },
|
||||
{ families: 12, declarations: 50, unique: 49 },
|
||||
);
|
||||
});
|
||||
|
||||
test("V1 acceptance rejects an unknown namespace", () => {
|
||||
const { ledger, packageManifest } = clonedInputs();
|
||||
ledger.families[0].acceptance[0] = "desktop:test:unknown";
|
||||
assert.throws(() => buildAcceptancePlan(ledger, packageManifest), /unsupported acceptance namespace/);
|
||||
});
|
||||
|
||||
test("V1 acceptance rejects a missing package script", () => {
|
||||
const { ledger, packageManifest } = clonedInputs();
|
||||
delete packageManifest.scripts["test:nonmesh-roundtrip"];
|
||||
assert.throws(() => buildAcceptancePlan(ledger, packageManifest), /package script test:nonmesh-roundtrip is missing/);
|
||||
});
|
||||
|
||||
test("V1 acceptance rejects an empty E2E pattern", () => {
|
||||
const { ledger, packageManifest } = clonedInputs();
|
||||
ledger.families[0].acceptance[0] = "web:e2e: ";
|
||||
assert.throws(() => buildAcceptancePlan(ledger, packageManifest), /E2E pattern must not be empty/);
|
||||
});
|
||||
|
||||
test("V1 acceptance rejects duplicate declarations within one family", () => {
|
||||
const { ledger, packageManifest } = clonedInputs();
|
||||
ledger.families[0].acceptance.push(ledger.families[0].acceptance[0]);
|
||||
assert.throws(() => buildAcceptancePlan(ledger, packageManifest), /duplicate acceptance token/);
|
||||
});
|
||||
Reference in New Issue
Block a user