fix(core-testing): address code review feedback for Task 1

- Remove unused @trpc/tanstack-react-query dependency
- Document renderWithProviders tRPC provider omission (boundary constraint)
- Implement deep merge in defineFactory (preserves nested sibling keys)
- Document httpBatchLink<any> rationale in mock-trpc.ts
- Align core-testing's own vitest.config with safety defaults (mockReset, unstubGlobals)
- Add createMockTrpcClient usage example to AGENTS.md

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

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-05 13:50:32 +02:00
parent 4ca083690f
commit a533be3c3a
8 changed files with 72 additions and 5 deletions

View File

@@ -7,6 +7,12 @@ export interface RenderOptions {
queryClient?: QueryClient;
}
// Wraps the given UI with QueryClientProvider only.
// This helper intentionally omits a TRPCProvider. Adding one would require importing
// AppRouter from @repo/core-api, which violates the tooling→core-composition boundary rule.
// For components that need tRPC in the render tree, the consumer must:
// 1. Wire their own TRPCProvider (from their app's tRPC client setup).
// 2. Pass a client built with createMockTrpcClient as the tRPC client.
export function renderWithProviders(
ui: ReactElement,
options: RenderOptions = {},