Commit f964523
committed
refactor(tests): annotate high-traffic component tests
Type annotations for 21 component test files. No behavior changes —
only type imports, describe-scope `let` declarations, context-value
casts via the established `as unknown as ContextValue` pattern, and
narrow casts at SDK-type access points.
- Channel/__tests__/{Channel,ownCapabilities,useMessageListPagination,
isAttachmentEqualHandler}.test.tsx
- ChannelList/__tests__/{ChannelList,ChannelListView}.test.tsx
- ChannelPreview/__tests__/ChannelPreviewView.test.tsx
- Chat/__tests__/Chat.test.tsx
- Message/MessageItemView/__tests__/{Message,MessageAuthor,
MessageContent,MessageItemView,MessagePinnedHeader,MessageReplies,
MessageStatus,MessageTextContainer,ReactionListBottom,
ReactionListTop}.test.tsx
- MessageList/__tests__/{MessageList,ScrollToBottomButton}.test.tsx
- Thread/__tests__/Thread.test.tsx
Conventions applied:
- `let client: StreamChat; let channel: Channel;` at describe scope.
- `{...} as unknown as ChannelContextValue` (or `ChatContextValue`,
`MessagesContextValue`, etc.) for partial context mocks — matches
`components/MessageList/__tests__/useMessageList.test.tsx:35,43`.
- `MessageResponse` → `LocalMessage` via small local `toLocalMessage`
helper where needed; SDK's `formatMessage` isn't used because it
requires a configured Channel.
- `ComponentProps<typeof X>` for `renderComponent({ props })` args.
- Numeric `id`s in mock-builder calls fixed to string.
Pre-existing latent test bug noted: `MessageStatus.test.tsx` used
`it.each('string', fn)` (malformed — string iterated as chars).
Converted to `it.skip` to preserve pre-migration runtime behavior
(the test body never executed) and filed as future work to fix the
test properly.
Takes test:typecheck 437 → 227 (−210). Full test suite: same
pre-existing SQLite-isolation flake in offline-support; no
regressions.1 parent 0be246a commit f964523
21 files changed
Lines changed: 700 additions & 403 deletions
File tree
- package/src/components
- ChannelList/__tests__
- ChannelPreview/__tests__
- Channel/__tests__
- Chat/__tests__
- MessageList/__tests__
- Message/MessageItemView/__tests__
- Thread/__tests__
Lines changed: 144 additions & 90 deletions
Large diffs are not rendered by default.
Lines changed: 26 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| 23 | + | |
| 24 | + | |
22 | 25 | | |
23 | | - | |
24 | | - | |
| 26 | + | |
| 27 | + | |
25 | 28 | | |
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
29 | | - | |
| 32 | + | |
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
| |||
40 | 43 | | |
41 | 44 | | |
42 | 45 | | |
43 | | - | |
| 46 | + | |
44 | 47 | | |
45 | 48 | | |
46 | 49 | | |
| |||
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
53 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
54 | 60 | | |
55 | 61 | | |
56 | 62 | | |
| |||
64 | 70 | | |
65 | 71 | | |
66 | 72 | | |
67 | | - | |
| 73 | + | |
| 74 | + | |
68 | 75 | | |
69 | 76 | | |
70 | 77 | | |
| 78 | + | |
71 | 79 | | |
72 | 80 | | |
73 | 81 | | |
74 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
75 | 90 | | |
76 | 91 | | |
77 | 92 | | |
| |||
92 | 107 | | |
93 | 108 | | |
94 | 109 | | |
95 | | - | |
96 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
97 | 114 | | |
98 | 115 | | |
99 | 116 | | |
| |||
Lines changed: 16 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | | - | |
35 | | - | |
| 35 | + | |
| 36 | + | |
36 | 37 | | |
37 | | - | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
51 | | - | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
64 | | - | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| |||
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
74 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
75 | 79 | | |
76 | | - | |
| 80 | + | |
77 | 81 | | |
78 | 82 | | |
79 | | - | |
| 83 | + | |
80 | 84 | | |
81 | 85 | | |
82 | 86 | | |
| |||
363 | 367 | | |
364 | 368 | | |
365 | 369 | | |
366 | | - | |
| 370 | + | |
367 | 371 | | |
368 | 372 | | |
369 | 373 | | |
| |||
378 | 382 | | |
379 | 383 | | |
380 | 384 | | |
381 | | - | |
| 385 | + | |
382 | 386 | | |
383 | 387 | | |
384 | | - | |
| 388 | + | |
385 | 389 | | |
386 | 390 | | |
387 | 391 | | |
| |||
397 | 401 | | |
398 | 402 | | |
399 | 403 | | |
400 | | - | |
| 404 | + | |
401 | 405 | | |
402 | 406 | | |
403 | 407 | | |
| |||
0 commit comments