Skip to content

enzyme -> RTL: convert the TemplateList component suites - #467

Merged
cigamit merged 1 commit into
ctrliq:mainfrom
blaipr:feature/rtl-components-templatelist
Jun 18, 2026
Merged

enzyme -> RTL: convert the TemplateList component suites#467
cigamit merged 1 commit into
ctrliq:mainfrom
blaipr:feature/rtl-components-templatelist

Conversation

@blaipr

@blaipr blaipr commented Jun 16, 2026

Copy link
Copy Markdown
Contributor
SUMMARY

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

Files migrated off mountWithContexts/enzyme onto renderWithContexts: TemplateList, TemplateListItem.

Selection (checkbox state), bulk delete (toolbar → confirm → deletion-error modal), and the per-row copy/launch/edit/visualizer actions are driven through the real controls and asserted by accessible name + the resulting API calls. Behaviour and assertions are preserved.

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

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

Migrate components/TemplateList (the shared templates list + list item) off
enzyme/mountWithContexts onto renderWithContexts (React Testing Library).
Selection, bulk delete, and copy/launch/edit actions are driven through the
real controls; 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

This PR continues the UI test migration from enzyme to React Testing Library by converting the shared TemplateList component test suites to drive assertions via accessible queries and real user interactions, while keeping behavior and API-call expectations intact.

Changes:

  • Migrated TemplateListItem tests from mountWithContexts to renderWithContexts, adding a table wrapper helper and replacing enzyme DOM traversal with RTL queries (screen, within, waitFor).
  • Migrated TemplateList tests to RTL user flows for selection, bulk delete (including deletion error modal handling), and copy actions; added readOptions mocks required by the component’s request bundle.
  • Introduced settleTooltips() usage to avoid PatternFly tooltip/focus-related async leakage between tests after closing modals.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
awx/ui/src/components/TemplateList/TemplateListItem.test.js Converts TemplateListItem suite to RTL with accessible queries and updated copy/error assertions.
awx/ui/src/components/TemplateList/TemplateList.test.js Converts TemplateList suite to RTL, exercising selection, delete/confirm/error-close flows, and copy behavior with appropriate API mocks.

@cigamit
cigamit merged commit 5ae493d 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