Skip to content

Fix/smschars remove duplicate tests#2610

Open
andrewleith wants to merge 6 commits intomainfrom
fix/smschars-remove-duplicate-tests
Open

Fix/smschars remove duplicate tests#2610
andrewleith wants to merge 6 commits intomainfrom
fix/smschars-remove-duplicate-tests

Conversation

@andrewleith
Copy link
Copy Markdown
Member

@andrewleith andrewleith commented Mar 12, 2026

Summary | Résumé

This pull request enhances the SMS Character Info component test suite by separating more cleanly the unit and UI tests.

Cypress E2E test improvements:

  • Added support for testing the SMS Character Info component with and without a service prefix, and refactored tests to cover prefix overhead, placeholder stripping, and live fragment count updates.

Jest unit test refactoring:

  • Removed redundant and overlapping test cases in smsCharacterInfo.test.js, consolidating tests to focus on shared CSV cases and removing manual DOM setup and teardown in favor of more concise, data-driven tests.

These changes improve both the developer experience (with clearer stories and more robust tests) and the reliability of the SMS fragment calculation logic, especially in real-world scenarios involving prefixes and personalization variables.

Test instructions | Instructions pour tester la modification

  • CI unit tests pass
  • CI UI tests pass

@github-actions
Copy link
Copy Markdown

@andrewleith andrewleith marked this pull request as ready for review March 12, 2026 12:43
@@ -0,0 +1,23 @@
{% from "components/sms-character-info.html" import sms_character_info %}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a separate storybook page for when the prefix is on.

@@ -61,7 +61,11 @@
{
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the existing page to the menu so we can navigate to it.

it("shows '1 text message.' for 160 GSM chars (1 part)", () => {
SmsCharacterInfo.typeContent(GSM_1_PART);
Components.FragmentCountText().should("have.text", "1 text message.");
describe("Text changes when variables are present", () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im unsure what you did in this file that wasn't being tested before?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing - I just moved the "UI" tests into cypress and kept the unit tests in Jest. Coverage should be the same.

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.

2 participants