Skip to content

[CLNP-8676][chore]: add SDK init and prop propagation integration tests#1447

Open
sf-tyler-jeong wants to merge 7 commits into
mainfrom
chore/CLNP-8676
Open

[CLNP-8676][chore]: add SDK init and prop propagation integration tests#1447
sf-tyler-jeong wants to merge 7 commits into
mainfrom
chore/CLNP-8676

Conversation

@sf-tyler-jeong

Copy link
Copy Markdown
Contributor

What's added

SDK init & connect integrity

  • SendbirdProvider.sdkInit — mounts the real provider, mocks only the @sendbird/chat boundary, and asserts init / connect / updateCurrentUserInfo / session handler receive exactly the customer-provided params (incl. sdkInitParams override survival, newInstance, and the onConnected / onFailed paths).
  • SendbirdProvider.themeAndLocale — theme <body> class toggle + stringSet merge (user value wins over defaults).

Prop / callback propagation (parent → child)

Render-prop, callback, and default-precedence coverage across the public entry points: App, GroupChannel / Channel / OpenChannel, GroupChannelList / ChannelList / OpenChannelList, ChannelSettings, CreateChannel / CreateOpenChannel, Thread, MessageSearch, Message, EditUserProfile, OpenChannelApp, OpenChannelSettings.

Approach: mock the child / boundary, capture the received props, and assert the user's render props and callbacks are invoked with the right arguments and that user values win over injected defaults.

Housekeeping

  • Normalized the pre-existing integration test filenames to *.integration.spec.tsx.
  • Fixed a copy-paste describe title in ThreadUI.integration.spec.tsx.

Production fixes (uncovered by the new tests)

Both are small, internal, and backward-compatible, and each ships with a regression test proven to fail on the pre-fix code:

  • OpenChannelListUIMemoizedAllChannels omitted renderChannelPreview / onChannelSelected / fetchingStatus / logger / openChannelListDispatcher from its useMemo deps, so swapping a render prop or callback while the channel-list reference was unchanged kept stale previews and stale click handlers. Added the missing deps plus the missing list key on the custom-preview wrapper.
  • MessageSearchUI — the custom renderSearchItem branch returned its element without a key while the built-in item branches use key={message.messageId}, so React logged the "unique key" warning and risked mis-keyed list reconciliation. Wrapped it in a keyed React.Fragment.

Ticket 2 of the stabilization plan. Verify that customer-provided values
reach the SDK and child components without being dropped or mutated, via
integration / render-level tests. Test code only; no production changes.

Shared test helpers (src/utils/testMocks):
- sendbirdChat: reusable @sendbird/chat module mock with a faithful
  connected-SDK appInfo shape so connect() runs to completion.
- renderWithSendbird: render/renderHook wrapped in a real SendbirdProvider.

Coverage (21 tests / 8 files):
- SendbirdProvider init end-to-end (mock only @sendbird/chat): init params
  incl. spread sdkInitParams, connect(userId, accessToken),
  updateCurrentUserInfo (+ not-called guard), setupSDK extensions/session
  handler, newInstance on first mount, onConnected, onFailed (error path).
- MessageList renderMessage parameter bag (default + custom).
- SendbirdProvider theme <body> class toggle + stringSet merge (not replace).
- GroupChannelProvider and AppLayout replyType/config precedence
  (module/App prop wins over dashboard config).
- OperatorList renderUserListItem; GroupChannelList renderChannelPreview/
  renderHeader; GroupChannelUI render-prop injection/forwarding.
Follow-up to the ticket-2 integration suite. Verify that customer-provided
values reach the SDK and child components without being dropped or mutated,
across the modules the first pass missed. Test code only.

- App: connection/init props forwarded to SendbirdProvider (+ empty-string defaults).
- GroupChannelProvider: onBeforeSend*/onBeforeUpdate* callbacks reach the context.
- OpenChannel / OpenChannelSettings: render-prop forwarding + default injection.
- Thread / MessageSearch / Channel (legacy) / CreateChannel / EditUserProfile:
  render-prop and callback propagation.
- ChannelSettings: settings-panel render props (header/profile/moderation/leave).
- SendbirdProvider: custom dateLocale reaches the localization context.
- Extract makeGroupChannelSendbirdState() shared fixture (dedupe the callback and
  replyType provider tests).
- Normalize all integration test filenames to *.integration.spec.tsx.
…cks change

MemoizedAllChannels omitted renderChannelPreview, onChannelSelected, logger,
openChannelListDispatcher (and fetchingStatus) from its useMemo deps, so a
customer swapping renderChannelPreview or onChannelSelected while the channel
list reference is unchanged kept stale previews and stale click callbacks. Add
the missing deps, plus the missing list key on the custom-preview wrapper.

Also adds OpenChannelListUI render-prop tests, including a rerender regression
guard that fails without this fix.
…ze filenames (CLNP-8676)

Follow-up integration coverage. Test code only.

New module coverage (previously had no integration test):
- OpenChannelApp: connection props forwarded to SendbirdProvider.
- CreateOpenChannel: renderProfileInput injection + closeModal/renderHeader forwarding.
- ChannelList (legacy): renderChannelPreview per channel + renderHeader.
- Message: MessageProvider exposes message/isByMe via useMessageContext.

Callback propagation:
- OpenChannelProvider: onBeforeSend*/onChatHeaderActionClick/onBackClick reach the context.
- CreateChannelProvider: onBeforeCreateChannel/onCreateChannelClick reach the store state.
- CreateOpenChannelProvider: the create flow invokes onBeforeCreateChannel + onCreateChannel.
- OpenChannelListUI: clicking a channel invokes onChannelSelected with the channel.

Housekeeping:
- Rename the 6 pre-existing CLNP-4657 integration files from *.integration.test.tsx to
  *.integration.spec.tsx so every integration file follows one convention.
- Fix a copy-paste describe title in ThreadUI.integration.spec.tsx (was 'CreateChannelUI').
- Fix a stale filename reference in a GroupChannelUI test comment.
…list

The custom renderSearchItem branch returned the element without a key while the
default MessageSearchItem/FileItem branches use key={message.messageId}, so a
customer-supplied renderSearchItem triggered React's "unique key" warning and
risked mis-keyed list reconciliation. Wrap it in a keyed React.Fragment to match.
The MessageSearchUI fix wraps a customer renderSearchItem result in a keyed
React.Fragment; before it, that branch returned the element without a key while
the built-in item branches use key={message.messageId}, so React logged the
"unique key" warning and risked mis-keyed list reconciliation.

Add a regression guard that renders several custom items and asserts no such
warning is emitted — proven to fail on the pre-fix code and pass with the fix.
…-8676)

The sdkInit and themeAndLocale integration specs silenced React's "not wrapped
in act" warning by assigning console.error = vi.fn(), which tripped eslint's
no-console rule (6 warnings). Switch to vi.spyOn(console, 'error') with the same
selective pass-through (non-act errors still surface) and restore via
vi.restoreAllMocks(). Behavior unchanged; lint is now clean.
@netlify

netlify Bot commented Jul 24, 2026

Copy link
Copy Markdown

Deploy Preview for sendbird-uikit-react ready!

Name Link
🔨 Latest commit 3d2c412
🔍 Latest deploy log https://app.netlify.com/projects/sendbird-uikit-react/deploys/6a62fab9d01d8c00082bc4a5
😎 Deploy Preview https://deploy-preview-1447--sendbird-uikit-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant