fix(tests): address Task 4 code review feedback

- Deprecate mockPayloadModule with throw guard (hoisting incompatible)
- Replace `as never` with stubPayloadConfig in payload-articles test (consistency)
- Tighten pages contract to use toHaveLength (exact assertions)
- Header contract: define CONTRACT_HEADER_SEED, assert item count + order

Reviewer: superpowers:code-reviewer (Task 4 of Plan 7).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-05 16:04:07 +02:00
parent e1355e6bc7
commit b3c903fd36
7 changed files with 76 additions and 36 deletions

View File

@@ -72,7 +72,7 @@ export const pagesRepositoryContract =
it("getPages with no filter returns all seeded pages", async () => {
const list = await repo.getPages();
expect(list.length).toBeGreaterThanOrEqual(2);
expect(list).toHaveLength(2);
for (const page of list) {
expect(page.id).toBeDefined();
expect(page.slug).toBeDefined();
@@ -82,7 +82,7 @@ export const pagesRepositoryContract =
it("getPages({ status: 'published' }) returns only published pages", async () => {
const published = await repo.getPages({ status: "published" });
expect(published.length).toBeGreaterThanOrEqual(1);
expect(published).toHaveLength(1);
for (const page of published) {
expect(page.status).toBe("published");
}
@@ -90,7 +90,7 @@ export const pagesRepositoryContract =
it("getPages({ status: 'draft' }) returns only draft pages", async () => {
const drafts = await repo.getPages({ status: "draft" });
expect(drafts.length).toBeGreaterThanOrEqual(1);
expect(drafts).toHaveLength(1);
for (const page of drafts) {
expect(page.status).toBe("draft");
}