Skip to content

Fixes #39385 - replace snapshot test for taskdashboardactions#824

Open
andreilakatos wants to merge 1 commit into
theforeman:masterfrom
andreilakatos:tasks-dashboard-actions-test-update
Open

Fixes #39385 - replace snapshot test for taskdashboardactions#824
andreilakatos wants to merge 1 commit into
theforeman:masterfrom
andreilakatos:tasks-dashboard-actions-test-update

Conversation

@andreilakatos
Copy link
Copy Markdown
Contributor

No description provided.

@andreilakatos andreilakatos force-pushed the tasks-dashboard-actions-test-update branch from 87adef2 to e9337f4 Compare June 1, 2026 12:20
@andreilakatos andreilakatos changed the title Fixes #39385 - replace snapshot test for taskdashboardactions component Fixes #39385 - replace snapshot test for taskdashboardactions Jun 1, 2026
@MariaAga MariaAga requested a review from Copilot June 3, 2026 14:43
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 testActionSnapshotWithFixtures snapshot testing with explicit toEqual/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'));
});
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.

2 participants