Skip to content

Commit 0076683

Browse files
committed
fix(client-react): typecheck the package's own tests instead of excluding them
`check:type-check-coverage` failed on the first push, and it was right. The initial commit added `**/*.test.tsx` to tsconfig's `exclude` to match the `**/*.test.ts` entry every sibling package carries — but that entry is frozen DEBT the repo is migrating away from (#4311), not a convention to copy. The gate's own summary makes it explicit: 21 packages still exclude their tests, carrying 2243 frozen raw errors in TEST_DEBT. Excluding one more would have reported green over source `tsc` never read. Drops the test exclusion entirely, so client-react typechecks its own tests and stays out of that ledger. Doing so immediately surfaced a real gap: the `METADATA_EVENT` fixture was declared and never used, because `useMetadataSubscription` was covered for re-subscription and unmount but not for delivery. Adds that assertion rather than deleting the fixture — 18 tests now. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LYnZrTwXbrctB8E8HpJAPT
1 parent 97dbfb2 commit 0076683

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

packages/client-react/src/realtime-hooks.test.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,19 @@ describe('#4682 events reach the caller', () => {
329329
expect(result.current?.type).toBe('data.records.updated');
330330
});
331331

332+
it('useMetadataSubscription exposes the latest metadata event', () => {
333+
const { client, metadata } = createFakeClient();
334+
const { result } = renderHook(() => useMetadataSubscription('object'), {
335+
wrapper: wrapperFor(client),
336+
});
337+
338+
expect(result.current).toBeNull();
339+
340+
act(() => metadata[0].deliver(METADATA_EVENT));
341+
342+
expect(result.current).toEqual(METADATA_EVENT);
343+
});
344+
332345
it('useDataSubscriptionCallback forwards the event without re-rendering state', () => {
333346
const { client, data } = createFakeClient();
334347
const seen: DataEvent[] = [];

packages/client-react/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
"types": ["node", "react"]
1111
},
1212
"include": ["src/**/*"],
13-
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.test.tsx"]
13+
"exclude": ["node_modules", "dist"]
1414
}

0 commit comments

Comments
 (0)