Skip to content

enzyme -> RTL: convert the ManagementJob screen suites - #438

Merged
cigamit merged 4 commits into
ctrliq:mainfrom
blaipr:feature/rtl-batch-management-job
Jun 18, 2026
Merged

enzyme -> RTL: convert the ManagementJob screen suites#438
cigamit merged 4 commits into
ctrliq:mainfrom
blaipr:feature/rtl-batch-management-job

Conversation

@blaipr

@blaipr blaipr commented Jun 16, 2026

Copy link
Copy Markdown
Contributor
SUMMARY

Converts the ManagementJob screen's test suite from enzyme to React Testing Library, continuing the incremental enzyme → RTL migration (one screen directory per PR).

Files migrated off mountWithContexts/enzyme onto renderWithContexts:

  • ManagementJobs — route panel resolves under a real v6 <Routes> (router not mocked)
  • ManagementJobList — list rendering, content-error state, add-button visibility
  • ManagementJobListItem — name/description, launch button visibility

Interactions now go through accessible roles and real user events. Behaviour and assertions are preserved.

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

npm test for the ManagementJob directory: 3 suites, 7 tests, all passing. ESLint clean. No production code changed — test-only.

Migrate the ManagementJob screen's test suite off enzyme/mountWithContexts
onto renderWithContexts (React Testing Library): ManagementJobs route
panel, ManagementJobList and ManagementJobListItem. Behaviour and
assertions are preserved; interactions go through accessible roles and
real user events.
@blaipr blaipr changed the title Convert ManagementJob screen tests from enzyme to React Testing Library enzyme -> RTL: convert the ManagementJob screen suites Jun 16, 2026
@cigamit
cigamit requested a review from Copilot June 17, 2026 07:34

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 ManagementJob screen test suites from Enzyme (mountWithContexts) to React Testing Library (renderWithContexts), as part of the incremental enzyme → RTL migration in the UI codebase.

Changes:

  • Converted ManagementJobs route-level suite to RTL assertions using screen.
  • Converted ManagementJobList suite to RTL queries (findByText, queryByRole) and removed enzyme-specific helpers.
  • Converted ManagementJobListItem suite to RTL assertions against accessible output (e.g., launch button by role/name).

Reviewed changes

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

File Description
awx/ui/src/screens/ManagementJob/ManagementJobs.test.js Switches ManagementJobs route test from Enzyme mount to RTL render + screen assertions.
awx/ui/src/screens/ManagementJob/ManagementJobList/ManagementJobList.test.js Converts list suite to RTL and updates async assertions for loaded/error states and add-button visibility.
awx/ui/src/screens/ManagementJob/ManagementJobList/ManagementJobListItem.test.js Converts row item suite to RTL and asserts name/description + launch button via accessible queries.

Comment on lines +70 to +73
const rows = managementJobs.data.results.map((job) => job.name);
rows.forEach((name) => {
expect(screen.getByText(name)).toBeInTheDocument();
});
blaipr added 2 commits June 17, 2026 09:43
# Conflicts:
#	awx/ui/src/screens/ManagementJob/ManagementJobs.test.js
@blaipr

blaipr commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. The test now asserts the exact number of data rows in addition to the job names, so missing or duplicate rows are caught.

awx/ui/node_modules was committed as a self-referential symlink; .gitignore only excludes the directory contents, not the symlink itself. Untrack it (also removes a cross-PR collision with another open PR that carried the same symlink).
@cigamit
cigamit merged commit 2c9bc29 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