Repository navigation
test(widget): add tests for bubble persistence, pre-chat message submit, and streamed sources - #633
Merged
Merged
Conversation
…it, and streamed sources
anurag629
approved these changes
Nov 21, 2026
anurag629
left a comment
Member
There was a problem hiding this comment.
Thanks @bhushan4work. The 'local' and 'session' tests have a second widget stay hidden after the first one's bubble was shown, which only holds because of the early return at packages/widget/src/dom/bubble.ts:56, and 'none' shows it again. The pre-chat test covers both sides of if (data.message) at widget.ts:756, and since the message case sees sendMessage called right away, the empty case would catch a stray send. The sources test follows both links from the stream through the message event and localStorage to a new widget. All checks pass, including e2e.
Member
|
Merged, thanks @bhushan4work. |
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 does this change?
Adds unit tests for three documented widget behaviors that lacked test coverage:
showOncepersistence acrosslocal,session, andnonemodes, as well asposition: 'bottom-left'.messagefield sending a chat request with that text, and sending nothing when empty.sourceparts, asserting links are rendered, included in themessageevent payload, stored inlocalStorage, and restored on next widget open.Closes #613
How I tested this
packages/widget/src/dom/bubble.tsline 56: confirmed the new bubble persistence tests failed, restored the line, and confirmed they passed.packages/widget/src/widget.tsline 754: confirmed the new pre-chat submit tests failed, restored the line, and confirmed they passed.packages/widget/src/widget.tsline 963: confirmed the new stream sources test failed, restored the line, and confirmed it passed.pnpm vitest run --project @chatcops/widget(passed, 33/33 test files).pnpm test:coverageand confirmed incoverage/lcov-report/index.htmlthatbubble.tsline 56 andwidget.tslines 754, 962, 963 are now covered.pnpm lint(passed cleanly).AI assistance
None
Checklist
devpnpm -r build,pnpm testandpnpm -r typecheckpass locallypnpm changeset) if this changescore,widgetorserverpnpm apirun andapi/committed if an exported type or option changed