Skip to content

Commit

Permalink
Updated components' stories
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonkopliku committed Jun 5, 2023
1 parent 5615924 commit e936e13
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
checkResultFactory,
addCriticalExpectExpectation,
withOverriddenValues,
catalogExpectExpectationFactory,
catalogExpectSameExpectationFactory,
} from '@lib/test-utils/factories';

import CheckResultDetail from './CheckResultDetail';
Expand All @@ -15,18 +17,32 @@ const clusterHosts = hostFactory.buildList(2);
const [{ id: target1 }, { id: target2 }] = clusterHosts;
const targetType = 'host';

const catalogExpectations = [
...catalogExpectExpectationFactory.buildList(5),
catalogExpectSameExpectationFactory.build(),
];

const [
{ name: expectationName1 },
{ name: expectationName2 },
{ name: expectationName3 },
{ name: expectationName4 },
{ name: expectationName5 },
{ name: expectationName6 },
] = catalogExpectations;

let checkResult = emptyCheckResultFactory.build({
targets: [target1, target2],
});

const { check_id: checkID } = checkResult;

checkResult = addPassingExpectExpectation(checkResult);
checkResult = addPassingExpectExpectation(checkResult);
checkResult = addCriticalExpectExpectation(checkResult);
checkResult = addCriticalExpectExpectation(checkResult);
checkResult = addCriticalExpectExpectation(checkResult);
checkResult = addPassingExpectSameExpectation(checkResult, 'expectation_name');
checkResult = addPassingExpectExpectation(checkResult, expectationName1);
checkResult = addPassingExpectExpectation(checkResult, expectationName2);
checkResult = addCriticalExpectExpectation(checkResult, expectationName3);
checkResult = addCriticalExpectExpectation(checkResult, expectationName4);
checkResult = addCriticalExpectExpectation(checkResult, expectationName5);
checkResult = addPassingExpectSameExpectation(checkResult, expectationName6);

const checkResultWithoutValues = withOverriddenValues(checkResult, target1, []);

Expand All @@ -49,7 +65,7 @@ export const Default = {
targetID: target1,
targetType,
executionData,
expectations: [],
expectations: catalogExpectations,
},
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { faker } from '@faker-js/faker';
import {
executionExpectationEvaluationErrorFactory,
failingExpectEvaluationFactory,
} from '@lib/test-utils/factories';

import ExpectationsResults from './ExpectationsResults';

export default {
Expand All @@ -17,3 +22,17 @@ export const Default = {
errorMessage: 'An error occurred',
},
};

export const WithFailureMessage = {
args: {
...Default.args,
results: [failingExpectEvaluationFactory.build()],
},
};

export const WithEvaluationError = {
args: {
...Default.args,
results: [executionExpectationEvaluationErrorFactory.build()],
},
};

0 comments on commit e936e13

Please sign in to comment.