Skip to content

Fixes #39386 - replace snapshot test for taskdashboardreducer#825

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

Fixes #39386 - replace snapshot test for taskdashboardreducer#825
andreilakatos wants to merge 1 commit into
theforeman:masterfrom
andreilakatos:tasks-dashboard-reducer-test-update

Conversation

@andreilakatos
Copy link
Copy Markdown
Contributor

No description provided.

@andreilakatos andreilakatos force-pushed the tasks-dashboard-reducer-test-update branch from 1f0e30b to 9af638f Compare June 1, 2026 12:21
@andreilakatos andreilakatos changed the title Fixes #39386 - replace snapshot test for taskdashboardreducer component Fixes #39386 - replace snapshot test for taskdashboardreducer 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

Replaces the snapshot-based unit test for TasksDashboardReducer with explicit state assertions, and removes the now-unused Jest snapshot file. This aligns the test intent more closely with reducer behavior and makes failures more targeted (per issue #39386).

Changes:

  • Rewrote TasksDashboardReducer.test.js from snapshot fixtures to explicit toEqual assertions per action.
  • Removed the Jest snapshot file that was only used by the prior snapshot-based test approach.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.

File Description
webpack/ForemanTasks/Components/TasksDashboard/tests/TasksDashboardReducer.test.js Replaces snapshot fixture testing with explicit reducer state assertions.
webpack/ForemanTasks/Components/TasksDashboard/tests/snapshots/TasksDashboardReducer.test.js.snap Removes obsolete snapshots after switching away from snapshot tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +21 to +22
it('should return the initial state', () => {
expect(reducer(undefined, {})).toEqual(initialState);
Comment on lines +25 to +30
it('should handle FOREMAN_TASKS_DASHBOARD_INIT', () => {
expect(
reducer(undefined, {
type: FOREMAN_TASKS_DASHBOARD_INIT,
})
).toEqual({
Comment on lines +36 to +42
it('should handle FOREMAN_TASKS_DASHBOARD_INIT with data', () => {
expect(
reducer(undefined, {
type: FOREMAN_TASKS_DASHBOARD_INIT,
payload: { time: 'some-time', query: 'some-query' },
})
).toEqual({
Comment on lines +49 to +55
it('should handle FOREMAN_TASKS_DASHBOARD_UPDATE_TIME', () => {
expect(
reducer(undefined, {
type: FOREMAN_TASKS_DASHBOARD_UPDATE_TIME,
payload: 'some-time',
})
).toEqual({
Comment on lines +61 to +67
it('should handle FOREMAN_TASKS_DASHBOARD_UPDATE_QUERY', () => {
expect(
reducer(undefined, {
type: FOREMAN_TASKS_DASHBOARD_UPDATE_QUERY,
payload: 'some-query',
})
).toEqual({
Comment on lines +73 to +78
it('should handle FOREMAN_TASKS_DASHBOARD_FETCH_TASKS_SUMMARY_REQUEST', () => {
expect(
reducer(undefined, {
type: FOREMAN_TASKS_DASHBOARD_FETCH_TASKS_SUMMARY_REQUEST,
})
).toEqual({
Comment on lines +84 to +90
it('should handle FOREMAN_TASKS_DASHBOARD_FETCH_TASKS_SUMMARY_SUCCESS', () => {
expect(
reducer(undefined, {
type: FOREMAN_TASKS_DASHBOARD_FETCH_TASKS_SUMMARY_SUCCESS,
payload: 'some-payload',
})
).toEqual({
Comment on lines +98 to +106
it('should handle FOREMAN_TASKS_DASHBOARD_FETCH_TASKS_SUMMARY_FAILURE', () => {
const error = new Error('some error');

expect(
reducer(undefined, {
type: FOREMAN_TASKS_DASHBOARD_FETCH_TASKS_SUMMARY_FAILURE,
payload: error,
})
).toEqual({
Copy link
Copy Markdown
Contributor

@Lukshio Lukshio left a comment

Choose a reason for hiding this comment

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

some-query can be easily changed to actual query which can help catch some issues in future

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.

3 participants