feat(harness): centralize browser coverage contract

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-03-24 18:34:56 +08:00
parent 151d776842
commit fe24dfba68
4 changed files with 227 additions and 122 deletions
@@ -0,0 +1,35 @@
// @vitest-environment node
import { describe, expect, it } from "vitest";
import harnessStoryContract from "../../tests/e2e/support/story-harness-contract.json";
describe("story harness contract", () => {
it("uses unique story ids", () => {
const storyIds = harnessStoryContract.stories.map((story) => story.id);
expect(new Set(storyIds).size).toBe(storyIds.length);
});
it("requires a reason for every curated story", () => {
expect(harnessStoryContract.stories.every((story) => story.reason.trim().length > 0)).toBe(true);
});
it("requires smoke scenarios for docs-smoke coverage", () => {
expect(
harnessStoryContract.stories
.filter((story) => story.suites.includes("docs-smoke"))
.every((story) => Boolean(story.smokeScenario))
).toBe(true);
});
it("keeps every story on at least one supported suite", () => {
const supportedSuites = new Set(["a11y", "docs-smoke"]);
expect(
harnessStoryContract.stories.every(
(story) => story.suites.length > 0 && story.suites.every((suite) => supportedSuites.has(suite))
)
).toBe(true);
});
});