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:
@@ -7,6 +7,7 @@
|
||||
"build": "echo 'placeholder — TanStack Start build configured in later plan'",
|
||||
"dev": "echo 'placeholder'",
|
||||
"lint": "eslint .",
|
||||
"test": "vitest run --passWithNoTests",
|
||||
"test:e2e": "playwright test",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
@@ -25,9 +26,15 @@
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.50.0",
|
||||
"@repo/core-eslint": "workspace:*",
|
||||
"@repo/core-testing": "workspace:*",
|
||||
"@repo/core-typescript": "workspace:*",
|
||||
"@testing-library/jest-dom": "^6.5.0",
|
||||
"@testing-library/react": "^16.0.0",
|
||||
"@testing-library/user-event": "^14.5.0",
|
||||
"@types/node": "^22.0.0",
|
||||
"@types/react": "^19.0.0",
|
||||
"@types/react-dom": "^19.0.0"
|
||||
"@types/react-dom": "^19.0.0",
|
||||
"jsdom": "^25.0.0",
|
||||
"vitest": "^3.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
23
apps/web-tanstack/src/routes/__root.test.tsx
Normal file
23
apps/web-tanstack/src/routes/__root.test.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import { describe, it, expect, vi } from "vitest";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import "@testing-library/jest-dom";
|
||||
|
||||
// Mock @tanstack/react-router so we don't need a full router context
|
||||
vi.mock("@tanstack/react-router", () => ({
|
||||
createRootRoute: vi.fn((opts: { component: React.ComponentType }) => ({
|
||||
options: { component: opts.component },
|
||||
})),
|
||||
Outlet: () => <div data-testid="outlet" />,
|
||||
}));
|
||||
|
||||
describe("Root route", () => {
|
||||
it("wraps Outlet with TanstackTrpcProvider (children render)", async () => {
|
||||
const { Route } = await import("./__root");
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const RootComponent = (Route as any).options.component as React.ComponentType;
|
||||
|
||||
render(<RootComponent />);
|
||||
|
||||
expect(screen.getByTestId("outlet")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -6,7 +6,8 @@
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
}
|
||||
},
|
||||
"types": ["vitest/globals", "@testing-library/jest-dom"]
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.tsx"],
|
||||
"exclude": ["node_modules"]
|
||||
|
||||
8
apps/web-tanstack/vitest.config.ts
Normal file
8
apps/web-tanstack/vitest.config.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import path from "node:path";
|
||||
import { mergeConfig } from "vitest/config";
|
||||
import { jsdomVitestConfig } from "@repo/core-typescript/vitest.base.jsdom";
|
||||
|
||||
export default mergeConfig(jsdomVitestConfig, {
|
||||
esbuild: { jsx: "automatic" },
|
||||
resolve: { alias: { "@": path.resolve(__dirname, "./src") } },
|
||||
});
|
||||
Reference in New Issue
Block a user