Skip to content

SAT-48786 - Convert inventory sync Toast tests to RTL - #1249

Merged
jeremylenz merged 1 commit into
theforeman:developfrom
tlabaj:SAT-48786-convert-toast-tests-to-rtl
Sep 1, 2026
Merged

jeremylenz merged 1 commit into
theforeman:developfrom
tlabaj:SAT-48786-convert-toast-tests-to-rtl

Conversation

@tlabaj

@tlabaj tlabaj commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

What are the changes introduced in this pull request?

Replace the Enzyme shallow tests for the inventory sync Toast with React Testing Library (SAT-48786).

The tests still cover the same cases: all three status counts including user_omitted, hiding the omitted section when the count is 0 or omitted, and the host-list links for sync / disconnect / user_omitted. They now query by role and visible text (getByRole('link'), getByText) instead of Enzyme wrappers and HostsWithStatusLink internals. MemoryRouter wraps the component because it uses Link.

No production UI changes.

Considerations taken when implementing this change?

  • Keep the same coverage; assert what the user sees (links and copy), not child-component types.
  • Wrap with MemoryRouter so react-router-dom Link can render.
  • Mock only foremanReact/common/I18n.
  • Leave other Enzyme tests in this area (for example Dashboard.test.js) alone.

What are the testing steps for this pull request?

From the Foreman core checkout (not the plugin directory):

npm run test:plugins foreman_rh_cloud -- --testPathPattern=Toast.test.js

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@chris1984 chris1984 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM I can't see anything that really stands out. @jeremylenz want to have a final look?

@jeremylenz jeremylenz 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.

LGTM 👍

@jeremylenz
jeremylenz merged commit d290dde into theforeman:develop Sep 1, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants