[#12588] Part of Improve test code coverage of core components #13189
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.
100% coverage on RichTextEditorComponent
and improves coverage on SessionsTable
Part of #12588
Outline of Solution
SessionTables improved coverage (PublishStatusTooltipPipe and SessionsTableComponent) (70.3% -> 100%)
Adds test cases for unexpected input (e.g., invalid and undefined statuses).
Improves test readability by using clear and meaningful variable names.
Reduces redundant setup code with a beforeEach block.
Ensures the code is more robust and resilient to edge cases, improving maintainability and reliability.
RichTextEditorComponent improved coverage (30%->100%)
The tests now verify all possible input properties (isDisabled, hasCharacterLimit, minHeightInPx, placeholderText, and richText) and ensure that custom values are correctly applied.
Added tests to simulate character count updates, keypress prevention, and content truncation for paste events.
Used a mock TinyMCE editor to closely mimic real editor behavior.
A MockRange class was introduced to accurately simulate Range objects, ensuring realistic cursor manipulation tests.
The setup function of TinyMCE was invoked manually, allowing detailed verification of event listeners (GetContent, keypress, paste).
Test functions were refactored with clearer naming conventions and logically grouped by feature (e.g., "Input Properties," "Output Events," "Character Limit Functionality").
setTimeout and done callbacks were used to ensure asynchronous actions (like setTimeout) are fully tested.