Skip to content

feat(tooling): add unit tests#643

Open
riteshfyi wants to merge 16 commits intowebex:nextfrom
riteshfyi:ut
Open

feat(tooling): add unit tests#643
riteshfyi wants to merge 16 commits intowebex:nextfrom
riteshfyi:ut

Conversation

@riteshfyi
Copy link
Contributor

COMPLETES #https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-772626

This pull request addresses

Adds unit tests for our meetings widget repo

by making the following changes

wrote UTs

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Tooling change
  • Internal code refactor

The following scenarios were tested

  • The testing is done with the amplify link
    < ENUMERATE TESTS PERFORMED, WHETHER MANUAL OR AUTOMATED >

The GAI Coding Policy And Copyright Annotation Best Practices

  • GAI was not used (or, no additional notation is required)
  • Code was generated entirely by GAI
  • GAI was used to create a draft that was subsequently customized or modified
  • Coder created a draft manually that was non-substantively modified by GAI (e.g., refactoring was performed by GAI on manually written code)
  • Tool used for AI assistance (GitHub Copilot / Other - specify)
    • Github Copilot
    • Other - Please Specify
  • This PR is related to
    • Feature
    • Defect fix
    • Tech Debt
    • Automation

Checklist before merging

  • I have not skipped any automated checks
  • All existing and new tests passed
  • I have updated the testing document
  • I have tested the functionality with amplify link

Make sure to have followed the contributing guidelines before submitting.

@riteshfyi riteshfyi requested a review from a team as a code owner March 9, 2026 10:50
@aws-amplify-us-east-2
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-643.d1b38q61t1z947.amplifyapp.com

@riteshfyi riteshfyi changed the title feat(meetings): add unit tests feat(tooling): add unit tests Mar 10, 2026
@Shreyas281299 Shreyas281299 added the validated Indicates that the PR is ready for actions label Mar 12, 2026
joinButton.focus = jest.fn();
wrapper.appendChild(joinButton);

Object.defineProperty(document, 'activeElement', {
Copy link
Contributor

Choose a reason for hiding this comment

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

🔴 High Severity - Test isolation leak

This test overrides document.activeElement using Object.defineProperty but never restores the original value in cleanup. This leaks across tests and can cause unpredictable behavior in subsequent tests.

Impact: Flaky tests, hard-to-debug failures in other test suites.

Suggestion: Save the original property descriptor before overriding and restore it in afterEach or at the end of this test:

const originalDescriptor = Object.getOwnPropertyDescriptor(document, 'activeElement');
// ... test code ...
Object.defineProperty(document, 'activeElement', originalDescriptor);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

adressed

Copy link
Contributor

@Shreyas281299 Shreyas281299 left a comment

Choose a reason for hiding this comment

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

Review Summary

Found 4 high-severity test isolation issues that need to be fixed:

  1. Line 285 & 318: overrides not restored - leaks across tests
  2. Line 429 & 472: overrides not restored on error - causes flaky tests
  3. Line 5: Module-scoped shared across tests without reset

Additionally, there's an optional suggestion at line 233 about refactoring the accessibility tests for better resilience.

Please address the high-severity isolation issues to prevent flaky test behavior.

Copy link
Contributor

@Shreyas281299 Shreyas281299 left a comment

Choose a reason for hiding this comment

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

Review Summary: Found 4 high-severity test isolation issues that need to be fixed. Lines 285 and 318: activeElement overrides not restored. Lines 429 and 472: MutationObserver overrides not restored on error. Line 5: Module-scoped state shared across tests. Please address these isolation issues to prevent flaky tests.

@riteshfyi
Copy link
Contributor Author

Comments Addressed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

validated Indicates that the PR is ready for actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants