Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
animehart committed Dec 15, 2023
1 parent 9ea963b commit 4f0da28
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 27 deletions.
27 changes: 4 additions & 23 deletions x-pack/plugins/cloud_security_posture/common/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,9 @@ export const getBenchmarkCisName = (benchmarkId: BenchmarksCisId) => {
return 'CIS EKS';
case 'cis_gcp':
return 'CIS GCP';
default:
return null;
}
return null;
};

export const getBenchmarkApplicableTo = (benchmarkId: BenchmarksCisId) => {
Expand All @@ -202,30 +203,10 @@ export const getBenchmarkApplicableTo = (benchmarkId: BenchmarksCisId) => {
return 'Amazon Elastic Kubernetes Service';
case 'cis_gcp':
return 'Google Cloud Provider';
default:
return null;
}
return null;
};
// export const getBenchmarkFilterQuery = (
// id: BenchmarkId,
// version: string,
// section?: string
// ): string =>
// `${CSP_BENCHMARK_RULE_SAVED_OBJECT_TYPE}.attributes.metadata.benchmark.id:${id} AND ${CSP_BENCHMARK_RULE_SAVED_OBJECT_TYPE}.attributes.metadata.benchmark.version:"v${version}"${
// section
// ? ` AND ${CSP_BENCHMARK_RULE_SAVED_OBJECT_TYPE}.attributes.metadata.section: "${section}"`
// : ''
// }`;

// export const getBenchmarkFilterQuery = (
// id: BenchmarkId,
// version: string,
// selectParams?: BenchmarkRuleSelectParams
// ): string =>
// `${CSP_BENCHMARK_RULE_SAVED_OBJECT_TYPE}.attributes.metadata.benchmark.id:${id} AND ${CSP_BENCHMARK_RULE_SAVED_OBJECT_TYPE}.attributes.metadata.benchmark.version:"v${version}"${
// selectParams?.section || selectParams?.ruleNumber
// ? ` AND ${CSP_BENCHMARK_RULE_SAVED_OBJECT_TYPE}.attributes.metadata.section: "${selectParams?.section}"`
// : ''
// }`;

export const getBenchmarkFilterQuery = (
id: BenchmarkId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ import { BenchmarksCisId, PageUrlParams } from '../../../common/types/latest';

export const Rules = ({ match: { params } }: RouteComponentProps<PageUrlParams>) => {
const { euiTheme } = useEuiTheme();
const integrationInfo = useCspBenchmarkIntegrationsV2();
const benchmarksInfo = useCspBenchmarkIntegrationsV2();
const SpyRoute = useSecuritySolutionContext()?.getSpyRouteComponent();

const [packageInfo] = integrationInfo.data?.items || [];
const [packageInfo] = benchmarksInfo.data?.items || [];

return (
<CloudPosturePage query={integrationInfo}>
<CloudPosturePage query={benchmarksInfo}>
<EuiPageHeader
alignItems={'bottom'}
bottomBorder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ describe('<Rules />', () => {
expect(useCspBenchmarkIntegrationsV2).toHaveBeenCalled();
});

it('Display Success State', async () => {
it('Display success state when result request is resolved', async () => {
const params = { benchmarkId: 'cis_eks', benchmarkVersion: '1.9.1' };
const Component = getTestComponent(params);
const result = createReactQueryResponse({
Expand Down Expand Up @@ -143,5 +143,6 @@ describe('<Rules />', () => {
render(<Component />);

expect(await screen.findByTestId(TEST_SUBJECTS.CSP_RULES_CONTAINER)).toBeInTheDocument();
expect(useCspBenchmarkIntegrationsV2).toHaveBeenCalled();
});
});

0 comments on commit 4f0da28

Please sign in to comment.