Skip to content

enzyme -> RTL: convert the ResourceAccessList component suites - #465

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

enzyme -> RTL: convert the ResourceAccessList component suites#465
cigamit merged 2 commits into
ctrliq:mainfrom
blaipr:feature/rtl-components-resourceaccesslist

Conversation

@blaipr

@blaipr blaipr commented Jun 16, 2026

Copy link
Copy Markdown
Contributor
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 onto renderWithContexts: 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
  • Bug, Docs Fix or other nominal change
COMPONENT NAME
  • UI
ADDITIONAL INFORMATION

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

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.

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 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 ResourceAccessListItem tests to RTL queries/assertions for rendered table content and role sections.
  • Reworked ResourceAccessList tests to use RTL user interactions (chip close → confirm modal → API assertions), plus DOM-level assertions for the Roles filter option value.
  • Updated DeleteRoleConfirmationModal tests 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.
@blaipr

blaipr commented Jun 17, 2026

Copy link
Copy Markdown
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
cigamit merged commit e6566ec 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