[CLNP-8676][chore]: add SDK init and prop propagation integration tests#1447
Open
sf-tyler-jeong wants to merge 7 commits into
Open
[CLNP-8676][chore]: add SDK init and prop propagation integration tests#1447sf-tyler-jeong wants to merge 7 commits into
sf-tyler-jeong wants to merge 7 commits into
Conversation
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.
✅ Deploy Preview for sendbird-uikit-react ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's added
SDK init & connect integrity
SendbirdProvider.sdkInit— mounts the real provider, mocks only the@sendbird/chatboundary, and assertsinit/connect/updateCurrentUserInfo/ session handler receive exactly the customer-provided params (incl.sdkInitParamsoverride survival,newInstance, and theonConnected/onFailedpaths).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
*.integration.spec.tsx.describetitle inThreadUI.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:
OpenChannelListUI—MemoizedAllChannelsomittedrenderChannelPreview/onChannelSelected/fetchingStatus/logger/openChannelListDispatcherfrom itsuseMemodeps, 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 listkeyon the custom-preview wrapper.MessageSearchUI— the customrenderSearchItembranch returned its element without a key while the built-in item branches usekey={message.messageId}, so React logged the "unique key" warning and risked mis-keyed list reconciliation. Wrapped it in a keyedReact.Fragment.