fix(incoming-task): add-uts-for-incoming-task#499
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
|
Thanks, @Shreyas281299, for the clarification! I have reverted the mocks for UI components and utils accordingly and used spies on the utils methods as suggested. |
adhmenon
left a comment
There was a problem hiding this comment.
Overall tests LGTM.
Have one remaining comment on trying to use a single method for capitalize but non blocking one.
|
|
||
| export type IncomingTaskComponentProps = Pick<TaskProps, 'incomingTask' | 'isBrowser' | 'accept' | 'reject' | 'logger'>; | ||
| export type IncomingTaskComponentProps = Pick<TaskProps, 'isBrowser' | 'accept' | 'reject' | 'logger'> & | ||
| Partial<Pick<TaskProps, 'incomingTask'>>; |
There was a problem hiding this comment.
Im a little lost here -> accept and reject are method on incomingTask here so if incomingTask is optional then accept and reject would also be optional.
Shreyas281299
left a comment
There was a problem hiding this comment.
Mostly looks good, just a last few changes.
| }; | ||
|
|
||
| // Common mock data for different scenarios | ||
| const mockIncomingTaskData = { |
There was a problem hiding this comment.
Can we put this in the fixtures
| expect(webRTCListItem).toHaveClass('task-list-hover'); | ||
| expect(webRTCListItem).toHaveAttribute('id', 'telephony-webrtc-task'); | ||
| expect(webRTCListItem).toHaveAttribute('role', 'listitem'); |
| }; | ||
|
|
||
| // Common mock data objects | ||
| const mockTaskData = { |
There was a problem hiding this comment.
Can we move this to fixtures and use it everywhere
|
|
||
| it('should handle prop combinations with correct DOM attributes and initial state', async () => { | ||
| const oneMinuteAgo = 1640995200000 - 60000; | ||
| const {rerender} = render(<TaskTimer startTimeStamp={oneMinuteAgo} />); |
There was a problem hiding this comment.
We are not awaiting render here, can you please upate this file.
| fireEvent.click(acceptButton); | ||
| expect(selectButtonsContainer).toMatchSnapshot(); | ||
|
|
||
| fireEvent.click(declineButton); | ||
| expect(selectButtonsContainer).toMatchSnapshot(); |
There was a problem hiding this comment.
This is incorrect, if we accept the call then the UI will cahnge. for testing decline you need to add a new task again, right?
| fireEvent.click(selectedListItem); | ||
| fireEvent.click(selectedListItem); | ||
| fireEvent.click(selectedListItem); | ||
| expect(selectedContainer).toMatchSnapshot(); |
There was a problem hiding this comment.
Why are we clicking thrice?
|
|
||
| // Verify unselected task uses medium typography for standard appearance | ||
| const unselectedTitle = unselectedContainer.querySelector('.task-digital-title'); | ||
| expect(unselectedTitle).toHaveAttribute('type', 'body-large-medium'); |
There was a problem hiding this comment.
is this the only attribute that we can test??
# [1.28.0-ccwidgets.98](v1.28.0-ccwidgets.97...v1.28.0-ccwidgets.98) (2025-07-29) ### Bug Fixes * **incoming-task:** add-uts-for-incoming-task ([#499](#499)) ([b9e6c7c](b9e6c7c))
|
🎉 This PR is included in version 1.28.0-ccwidgets.98 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |

COMPLETES #https://jira-eng-sjc12.cisco.com/jira/browse/CAI-6606
This pull request addresses
As part of this ticket, unit tests have been implemented for both the Incoming Task and Task List components to ensure all UI cases are properly tested with 100% coverage. All UTs are written under the cc-components package.
by making the following changes
Change Type
The following scenarios were tested
< ENUMERATE TESTS PERFORMED, WHETHER MANUAL OR AUTOMATED >
The GAI Coding Policy And Copyright Annotation Best Practices
Checklist before merging