Skip to content

enzyme -> RTL: convert the NotificationList component suites - #470

Merged
cigamit merged 2 commits into
ctrliq:mainfrom
blaipr:feature/rtl-components-notificationlist
Jun 18, 2026
Merged

enzyme -> RTL: convert the NotificationList component suites#470
cigamit merged 2 commits into
ctrliq:mainfrom
blaipr:feature/rtl-components-notificationlist

Conversation

@blaipr

@blaipr blaipr commented Jun 16, 2026

Copy link
Copy Markdown
Contributor
SUMMARY

Converts the NotificationList component test suite (components/NotificationList) from enzyme to React Testing Library, continuing the enzyme → RTL migration (components, one directory per PR).

Files migrated off mountWithContexts/enzyme onto renderWithContexts: NotificationList, NotificationListItem.

The per-row start/success/error/approval toggles are driven through the real PF Switch controls (disambiguated by their stable input ids / accessible names) and asserted via toBeChecked() + the associate/disassociate API calls; the failure path asserts the Error! AlertModal. Behaviour and assertions are preserved.

ISSUE TYPE
  • Bug, Docs Fix or other nominal change
COMPONENT NAME
  • UI
ADDITIONAL INFORMATION

npm test for components/NotificationList: 2 suites, 19 tests, all passing. ESLint clean (--no-ignore). No production code changed — test-only.

Migrate components/NotificationList (NotificationList and
NotificationListItem) off enzyme/mountWithContexts onto renderWithContexts
(React Testing Library). The per-row start/success/error/approval toggles
are driven through the real Switch controls (by id/accessible name) and
asserted via the associate/disassociate API calls; behaviour and
assertions are preserved.

Copilot AI left a comment

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.

Pull request overview

Migrates the NotificationList component test suites from Enzyme (mountWithContexts) to React Testing Library (renderWithContexts) as part of the ongoing UI testing modernization, keeping assertions focused on user-observable behavior (PF Switch toggles + resulting API calls / error modal).

Changes:

  • Converted NotificationListItem tests to RTL queries (screen.getByRole) and userEvent interactions for PF Switch controls.
  • Converted NotificationList tests to RTL rendering and assertions, driving toggles via real checkbox inputs (by stable id) and validating associate/disassociate API calls plus the error modal path.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
awx/ui/src/components/NotificationList/NotificationListItem.test.js Replaces Enzyme mounting and .simulate() with RTL renderWithContexts, screen queries, and userEvent clicks for row toggles.
awx/ui/src/components/NotificationList/NotificationList.test.js Replaces Enzyme act()/wrapper assertions with RTL waitFor, checkbox id-based toggle interactions, and modal-based error assertions.

Comment on lines +190 to +192
// the original suite asserted an ErrorDetail rendered; the toggle failure
// surfaces it inside the "Error!" AlertModal dialog.
expect(await screen.findByText('Error!')).toBeInTheDocument();
Assert the failure surfaces the Error! AlertModal dialog containing the ErrorDetail (Details) toggle, instead of only checking for the Error! text.
@blaipr

blaipr commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Pushed a commit: the failure path now asserts the Error AlertModal dialog is present and contains the ErrorDetail Details toggle, rather than only checking for the Error text.

@cigamit
cigamit merged commit c693946 into ctrliq:main Jun 18, 2026
@cigamit cigamit self-assigned this Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants