Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
Signed-off-by: Sajid Alam <[email protected]>
  • Loading branch information
SajidAlamQB committed Jul 24, 2024
1 parent 07bb7b7 commit 2c80e6a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/components/settings-modal/settings-modal.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ describe('SettingsModal', () => {

mapDispatchToProps(dispatch).onToggleShowDatasetPreviews(false);
expect(dispatch.mock.calls[3][0]).toEqual({
type: 'UPDATE_DATASET_PREVIEWS',
payload: { showDatasetPreviews: false },
type: 'UPDATE_USER_PREFERENCES',
payload: { preferences: { showDatasetPreviews: false } },
});
});
});
14 changes: 8 additions & 6 deletions src/reducers/reducers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
import { UPDATE_ACTIVE_PIPELINE } from '../actions/pipelines';
import { TOGGLE_MODULAR_PIPELINE_ACTIVE } from '../actions/modular-pipelines';
import { TOGGLE_GRAPH_LOADING } from '../actions/graph';
import { UPDATE_DATASET_PREVIEWS } from '../actions/preferences';
import { UPDATE_USER_PREFERENCES } from '../actions/preferences';

describe('Reducer', () => {
it('should return an Object', () => {
Expand Down Expand Up @@ -142,14 +142,16 @@ describe('Reducer', () => {
});
});

describe('UPDATE_DATASET_PREVIEWS', () => {
describe('UPDATE_USER_PREFERENCES', () => {
it('should update the value of showDatasetPreviews', () => {
const newState = reducer(mockState.spaceflights, {
type: UPDATE_DATASET_PREVIEWS,
payload: { showDatasetPreviews: true },
type: UPDATE_USER_PREFERENCES,
payload: { preferences: { showDatasetPreviews: true } },
});
expect(mockState.spaceflights.showDatasetPreviews).toBe(true);
expect(newState.showDatasetPreviews).toBe(true);
expect(mockState.spaceflights.userPreferences.showDatasetPreviews).toBe(
true
);
expect(newState.userPreferences.showDatasetPreviews).toBe(true);
});
});

Expand Down

0 comments on commit 2c80e6a

Please sign in to comment.