Skip to content

Commit 0d164b6

Browse files
committed
refactor(tests): annotate offline-support helpers
Type annotations for the two large integration-test helpers. No behavior changes. - offline-feature.tsx: narrow `_fiber` access via `as unknown as { _fiber: { pendingProps: { testID: string } } }` at 13 call sites; rename `userId` → `user_id` in `generateMessage` options (snake_case per SDK); type `ChannelSort` literals properly (`last_updated: 1`); narrow `tablesInDb`, `JSON.parse` args, and `new Date(...)` args from `unknown`; import `ChannelMemberResponse`, `ChannelSort`, `Event`, `MessageResponse`, `ReactionResponse`, `ChannelAPIResponse` as `type` imports. - optimistic-update.tsx: local wrapper cast `Channel as unknown as ComponentType<... & { initialValue?: string }>` to preserve the legacy `initialValue` prop the test passes; typed empty accumulators (`const newLatestReactions: ReactionResponse[]`); non-null assertion on `newReaction.user!.id`; cast `doUpdateMessageRequest` callbacks whose test-return shape doesn't include SDK-required `duration` etc. Latent test bugs preserved (passing undeclared fields at runtime that the SDK types don't include — `cid` on `ChannelMemberResponse` and `GeneratedChannelResponseCustomValues`, `last_read` instead of `last_read_at` on Event). Widened locally with `as unknown as T & { cid: string }` etc. rather than changing test data. These are follow-up items. Takes test:typecheck 69 → 0. Full test suite: 752 passed, 14 skipped; only the pre-existing SQLite-isolation flake in offline-support/index.test.ts fails. No regressions.
1 parent 316b8c0 commit 0d164b6

2 files changed

Lines changed: 184 additions & 87 deletions

File tree

0 commit comments

Comments
 (0)