feat(apps): add unit tests for providers + bind-production + cms config

web-next: bindAllProduction calls all 4 feature binders exactly once;
Providers renders children. web-tanstack: equivalent providers + bind tests.
cms: payload.config exports a SanitizedConfig with all expected collections.

Spec: §6.7, §9

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-05 16:34:19 +02:00
parent 3ff1f4a6a3
commit 119eab49fe
14 changed files with 185 additions and 6 deletions

View File

@@ -0,0 +1,37 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
vi.mock("@repo/core-cms", () => ({ default: Promise.resolve({}) }));
vi.mock("@repo/blog/di/bind-production", () => ({ bindProductionBlog: vi.fn() }));
vi.mock("@repo/auth/di/bind-production", () => ({ bindProductionAuth: vi.fn() }));
vi.mock("@repo/marketing-pages/di/bind-production", () => ({ bindProductionMarketingPages: vi.fn() }));
vi.mock("@repo/navigation/di/bind-production", () => ({ bindProductionNavigation: vi.fn() }));
describe("bindAllProduction", () => {
beforeEach(() => {
vi.resetModules();
vi.clearAllMocks();
});
it("binds all four feature production repos", async () => {
const { bindAllProduction } = await import("./bind-production");
const { bindProductionBlog } = await import("@repo/blog/di/bind-production");
const { bindProductionAuth } = await import("@repo/auth/di/bind-production");
const { bindProductionMarketingPages } = await import("@repo/marketing-pages/di/bind-production");
const { bindProductionNavigation } = await import("@repo/navigation/di/bind-production");
await bindAllProduction();
expect(bindProductionBlog).toHaveBeenCalledOnce();
expect(bindProductionAuth).toHaveBeenCalledOnce();
expect(bindProductionMarketingPages).toHaveBeenCalledOnce();
expect(bindProductionNavigation).toHaveBeenCalledOnce();
});
it("is idempotent — second call does not re-bind", async () => {
const { bindAllProduction } = await import("./bind-production");
const { bindProductionBlog } = await import("@repo/blog/di/bind-production");
await bindAllProduction();
await bindAllProduction();
expect(bindProductionBlog).toHaveBeenCalledOnce();
});
});