Fixes #39385 - replace snapshot test for taskdashboardactions#824
Open
andreilakatos wants to merge 1 commit into
Open
Fixes #39385 - replace snapshot test for taskdashboardactions#824andreilakatos wants to merge 1 commit into
andreilakatos wants to merge 1 commit into
Conversation
87adef2 to
e9337f4
Compare
There was a problem hiding this comment.
Pull request overview
This PR replaces the snapshot-based unit test for TasksDashboard action creators with explicit assertions, and removes the corresponding Jest snapshot file. This improves the clarity of the test expectations and reduces reliance on snapshot formatting.
Changes:
- Replaced
testActionSnapshotWithFixturessnapshot testing with explicittoEqual/dispatch assertions for TasksDashboard actions. - Added direct assertions for success/failure dispatch flows in
fetchTasksSummary. - Removed the obsolete snapshot file for TasksDashboard actions.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardActions.test.js |
Converts snapshot fixtures into explicit unit tests for action objects and thunk dispatch behavior. |
webpack/ForemanTasks/Components/TasksDashboard/__tests__/__snapshots__/TasksDashboardActions.test.js.snap |
Removes snapshots no longer used after migrating to explicit assertions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+57
to
+68
| it('should update-query', () => { | ||
| const dispatch = jest.fn(); | ||
| const getState = jest.fn(); | ||
|
|
||
| updateQuery('some-query')(dispatch, getState); | ||
|
|
||
| expect(resolveQuery).toHaveBeenCalledWith('some-query', undefined); | ||
| expect(dispatch).toHaveBeenCalledWith({ | ||
| type: FOREMAN_TASKS_DASHBOARD_UPDATE_QUERY, | ||
| payload: 'some-query', | ||
| }); | ||
| }); |
Comment on lines
+109
to
+113
| expect(dispatch.mock.calls[1][0].type).toBe( | ||
| FOREMAN_TASKS_DASHBOARD_FETCH_TASKS_SUMMARY_FAILURE | ||
| ); | ||
| expect(dispatch.mock.calls[1][0].payload).toEqual(new Error('wrong time')); | ||
| }); |
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.
No description provided.