enzyme -> RTL: convert the ResourceAccessList component suites - #465
Merged
cigamit merged 2 commits intoJun 18, 2026
Merged
Conversation
Migrate components/ResourceAccessList (the access list, list item, and the delete-role confirmation modal) off enzyme/mountWithContexts onto renderWithContexts (React Testing Library). Role chips are deleted through the real close-button + confirm flow; behaviour and assertions are preserved.
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates the ResourceAccessList component test suites from Enzyme (mountWithContexts) to React Testing Library (renderWithContexts), aligning with the ongoing UI test migration and keeping behavior-focused assertions around role chips, confirmation modals, and access list search behavior.
Changes:
- Converted
ResourceAccessListItemtests to RTL queries/assertions for rendered table content and role sections. - Reworked
ResourceAccessListtests to use RTL user interactions (chip close → confirm modal → API assertions), plus DOM-level assertions for the Roles filter option value. - Updated
DeleteRoleConfirmationModaltests to assert dialog title/body via RTL.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| awx/ui/src/components/ResourceAccessList/ResourceAccessListItem.test.js | Replaces Enzyme table cell/Detail prop assertions with RTL DOM assertions for names and role sections. |
| awx/ui/src/components/ResourceAccessList/ResourceAccessList.test.js | Rewrites suite to RTL rendering and user flows for deleting roles and asserting toolbar Roles filter behavior. |
| awx/ui/src/components/ResourceAccessList/DeleteRoleConfirmationModal.test.js | Migrates modal rendering assertions to RTL dialog/body text checks. |
Comment on lines
+45
to
+47
| // Username link plus first name / last name cells. | ||
| expect(screen.getByRole('link', { name: 'jane' })).toBeInTheDocument(); | ||
| expect(screen.getByText('brown')).toBeInTheDocument(); |
Comment on lines
40
to
44
| test('should render the User confirmation delete modal', () => { | ||
| delete role.team_id; | ||
| const wrapper = mountWithContexts( | ||
| renderWithContexts( | ||
| <DeleteRoleConfirmationModal | ||
| role={role} |
Assert the First name cell (by its column label) alongside the last name; use a per-test copy of the role fixture instead of mutating the shared constant.
Contributor
Author
|
Thanks for the review. Pushed a commit: assert the First name cell by its column label alongside the last name, and use a per-test copy of the role fixture instead of mutating the shared constant. |
cigamit
approved these changes
Jun 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
SUMMARY
Converts the ResourceAccessList component test suite (
components/ResourceAccessList) from enzyme to React Testing Library, continuing the enzyme → RTL migration (components, one directory per PR).Files migrated off
mountWithContexts/enzyme ontorenderWithContexts:ResourceAccessList,ResourceAccessListItem,DeleteRoleConfirmationModal.Role chips are removed through the real chip close-button → confirm-modal flow (asserting the disassociate API call + refetch); the search Roles column's merged admin id is asserted via the value Select. Behaviour and assertions are preserved.
ISSUE TYPE
COMPONENT NAME
ADDITIONAL INFORMATION
npm testforcomponents/ResourceAccessList: 3 suites, 13 tests, all passing. ESLint clean (--no-ignore). No production code changed — test-only.