Skip to content

Commit

Permalink
rename functions and add space
Browse files Browse the repository at this point in the history
  • Loading branch information
EMaksy committed Aug 29, 2023
1 parent 97b2a93 commit 4f2d409
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,10 @@ export default {
onUpdateCatalog: {
description: 'Updates the catalog',
},

isSavingSelection: {
description:
'Whether Save Checks Selection button is enabled or disabled',
},

onSaveSelection: {
description: 'Updates the selected checks on save',
},
Expand Down
1 change: 1 addition & 0 deletions assets/js/components/HostDetails/HostSettingsPage.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ describe('HostSettingsPage component', () => {
const startExecutionButton = screen.getByText('Start Execution');
expect(startExecutionButton).toBeDisabled();
});

it('should render HostSettingsPage with an enabled start execution button, as checks are selected', () => {
const hosts = hostFactory.buildList(2, {
provider: 'azure',
Expand Down
4 changes: 2 additions & 2 deletions assets/js/state/actions/lastExecutions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const UPDATE_LAST_EXECUTION = 'UPDATE_LAST_EXECUTION';
export const EXECUTION_REQUESTED = 'EXECUTION_REQUESTED';
export const CLUSTER_EXECUTION_REQUESTED = 'CLUSTER_EXECUTION_REQUESTED';
export const HOST_EXECUTION_REQUESTED = 'HOST_EXECUTION_REQUESTED';

export const updateLastExecution = (groupID) => ({
Expand All @@ -8,7 +8,7 @@ export const updateLastExecution = (groupID) => ({
});

export const executionRequested = (clusterID, hosts, checks, navigate) => ({
type: EXECUTION_REQUESTED,
type: CLUSTER_EXECUTION_REQUESTED,
payload: { clusterID, hosts, checks, navigate },
});

Expand Down
4 changes: 2 additions & 2 deletions assets/js/state/sagas/lastExecutions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { put, call, takeEvery, select } from 'redux-saga/effects';

import {
UPDATE_LAST_EXECUTION,
EXECUTION_REQUESTED,
CLUSTER_EXECUTION_REQUESTED,
HOST_EXECUTION_REQUESTED,
} from '@state/actions/lastExecutions';
import { notify } from '@state/actions/notifications';
Expand Down Expand Up @@ -95,7 +95,7 @@ export function* watchUpdateLastExecution() {
}

export function* watchRequestExecution() {
yield takeEvery(EXECUTION_REQUESTED, requestExecution);
yield takeEvery(CLUSTER_EXECUTION_REQUESTED, requestExecution);
}

export function* watchHostRequestExecution() {
Expand Down
12 changes: 6 additions & 6 deletions assets/js/state/sagas/lastExecutions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ const axiosMock = new MockAdapter(networkClient);
const lastExecutionURL = (groupID) =>
`/api/v1/checks/groups/${groupID}/executions/last`;

const triggerChecksExecutionURL = (clusterId) =>
const triggerClusterChecksExecutionURL = (clusterId) =>
`/clusters/${clusterId}/checks/request_execution`;

const hostTriggerChecksExecutionURL = (hostID) =>
const triggerHostChecksExecutionURL = (hostID) =>
`/hosts/${hostID}/checks/request_execution`;

describe('lastExecutions saga', () => {
Expand Down Expand Up @@ -97,7 +97,7 @@ describe('lastExecutions saga', () => {
const hosts = [faker.datatype.uuid(), faker.datatype.uuid()];
const checks = [faker.color.human(), faker.color.human()];

axiosMock.onPost(triggerChecksExecutionURL(clusterID)).reply(202, {});
axiosMock.onPost(triggerClusterChecksExecutionURL(clusterID)).reply(202, {});

const payload = { clusterID, hosts, checks };
const dispatched = await recordSaga(
Expand Down Expand Up @@ -127,7 +127,7 @@ describe('lastExecutions saga', () => {
const hosts = [faker.datatype.uuid(), faker.datatype.uuid()];
const checks = [faker.color.human(), faker.color.human()];

axiosMock.onPost(triggerChecksExecutionURL(clusterID)).reply(400, {});
axiosMock.onPost(triggerClusterChecksExecutionURL(clusterID)).reply(400, {});

const payload = { clusterID, hosts, checks };
const dispatched = await recordSaga(
Expand Down Expand Up @@ -156,7 +156,7 @@ describe('lastExecutions saga', () => {
const { id: hostID, hostname: hostName } = host;
const checks = [faker.datatype.uuid(), faker.datatype.uuid()];

axiosMock.onPost(hostTriggerChecksExecutionURL(hostID)).reply(202, {});
axiosMock.onPost(triggerHostChecksExecutionURL(hostID)).reply(202, {});
const payload = { checks, host };

const dispatched = await recordSaga(requestHostExecution, {
Expand All @@ -176,7 +176,7 @@ describe('lastExecutions saga', () => {
const { id: hostID, hostname: hostName } = host;
const checks = [faker.datatype.uuid(), faker.datatype.uuid()];

axiosMock.onPost(hostTriggerChecksExecutionURL(hostID)).reply(400, {});
axiosMock.onPost(triggerHostChecksExecutionURL(hostID)).reply(400, {});

const payload = { checks, host };
const dispatched = await recordSaga(requestHostExecution, {
Expand Down

0 comments on commit 4f2d409

Please sign in to comment.