Skip to content

Commit

Permalink
remove unused selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
balanza committed Jul 2, 2024
1 parent 700c914 commit c058961
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 96 deletions.
11 changes: 0 additions & 11 deletions assets/js/state/selectors/activityLogsSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,6 @@ export const getActivityLogsSettings = createSelector(
})
);

export const getActivityLogsSettingsLoading = createSelector(
[getActivityLogsSettings],
({ loading }) => loading
);

export const getActivityLogsSettingsSaved = createSelector(
[getActivityLogsSettings],
({ settings: { retention_time } }) =>
!!(retention_time && retention_time.value && retention_time.unit)
);

export const getActivityLogsSettingsErrors = createSelector(
[getActivityLogsSettings],
({ errors }) => errors
Expand Down
86 changes: 1 addition & 85 deletions assets/js/state/selectors/activityLogsSettings.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import {
getActivityLogsSettings,
getActivityLogsSettingsLoading,
getActivityLogsSettingsSaved,
} from './activityLogsSettings';
import { getActivityLogsSettings } from './activityLogsSettings';

describe('Activity Logs Settings selector', () => {
describe('get activity logs settings', () => {
Expand Down Expand Up @@ -34,84 +30,4 @@ describe('Activity Logs Settings selector', () => {
}
);
});

describe('get activity logs settings loading', () => {
const scenarios = [
{
state: { loading: false },
result: false,
},
{
state: { loading: true },
result: true,
},
];

it.each(scenarios)(
'should return if the activity logs settings are loading',
({ state, result }) => {
expect(
getActivityLogsSettingsLoading({ activityLogsSettings: state })
).toEqual(result);
}
);
});

describe('get if activity logs settings saved', () => {
const scenarios = [
{
state: {
loading: false,
settings: {
retention_time: { value: 2, unit: 'week' },
},
errors: null,
editing: false,
},
result: true,
},
{
state: {
loading: false,
settings: {
retention_time: undefined,
},
errors: null,
editing: false,
},
result: false,
},
{
state: {
loading: false,
settings: {
retention_time: {} /* invalid */,
},
errors: null,
editing: false,
},
result: false,
},
{
state: {
loading: true,
settings: {
retention_time: undefined,
},
errors: null,
editing: false,
},
result: false,
},
];

it.each(scenarios)(
'should return if the activity logs settings are saved',
({ state, result }) => {
expect(
getActivityLogsSettingsSaved({ activityLogsSettings: state })
).toEqual(result);
}
);
});
});

0 comments on commit c058961

Please sign in to comment.