SAT-48787 - replace InsightsTab Enzyme integration test with RTL - #1250
Merged
chris1984 merged 1 commit intoSep 2, 2026
Merged
Conversation
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="webpack/InsightsHostDetailsTab/__tests__/InsightsTabIntegration.test.js" line_range="41-44" />
<code_context>
+
+ renderConnectedTab();
+
+ expect(
+ await screen.findByRole('heading', {
+ name: 'No recommendations were found for this host!',
+ })
+ ).toBeInTheDocument();
+
</code_context>
<issue_to_address>
**issue (testing):** The empty-state assertion passes from the reducer's initial `hits: []` state before the mocked API request resolves, so this test also passes if the API response is never dispatched into Redux or the response-handling path is broken.
**Triggers:** When `API.get` remains pending or the success action fails to update the `hostInsights` reducer.
**Suggested fix:** Wait for the API request to resolve and assert that the empty state is rendered after the corresponding Redux update, or first assert the request is made and use an explicit state transition check.
</issue_to_address>Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: webpack/InsightsHostDetailsTab/__tests__/InsightsTabIntegration.test.js:44
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
MariaAga
approved these changes
Sep 1, 2026
MariaAga
left a comment
Member
There was a problem hiding this comment.
code lgtm, and I ran the tests locally
chris1984
approved these changes
Sep 1, 2026
tlabaj
force-pushed
the
SAT-48787-insights-tab-integration
branch
from
September 2, 2026 13:25
9039668 to
85c0af8
Compare
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.
What are the changes introduced in this pull request?
Replace the Enzyme InsightsTab integration test with React Testing Library so the connected host-details tab no longer depends on
IntegrationTestHelper.SAT-48787: https://redhat.atlassian.net/browse/SAT-48787
The connected tab now renders with a Redux store built from plugin reducers.
API.getis mocked, and the test asserts:API.getis called with/insights_cloud/hits/:hostIdConsiderations taken when implementing this change?
InsightsTab.test.jsalready covers the presentational component (empty vs list UI, sort by risk,fetchHitson mount). This file only covers Redux + API wiring.renderWithStoreuses core reducers, which do not includeForemanRhCloud.hostInsights. The test creates its own store fromForemanRhCloudReducersplus thunk, matching whatIntegrationTestHelperused.What are the testing steps for this pull request?
From the Foreman directory:
That filter runs the InsightsTab suites, including
InsightsTabIntegration.test.js. Both new cases should pass (empty state and hits list).If the plugin is registered in Foreman, this is equivalent:
Confirm
webpack/InsightsHostDetailsTab/__tests__/InsightsTabIntegration.test.jshas no Enzyme imports (IntegrationTestHelper,mount, snapshots).