Skip to content

Commit

Permalink
chore(RHINENG-10336): Update cypress code-cov package (#514)
Browse files Browse the repository at this point in the history
* chore(RHINENG-10336): Update cypress code-cov package

* Fix issues with tests

There were a couple of issues with App Zero State tests that have been resolved in this commit.

---------

Co-authored-by: Michael Johnson <[email protected]>
  • Loading branch information
johnsonm325 and Michael Johnson authored Oct 8, 2024
1 parent f8fb218 commit 5e52f86
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 36 deletions.
38 changes: 16 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"@babel/preset-env": "7.15.4",
"@babel/preset-flow": "7.14.5",
"@babel/preset-react": "7.14.5",
"@cypress/code-coverage": "^3.10.0",
"@cypress/code-coverage": "^3.12.37",
"@cypress/react18": "^2.0.1",
"@formatjs/cli": "4.2.33",
"@redhat-cloud-services/frontend-components-config": "^6.0.13",
Expand Down
1 change: 1 addition & 0 deletions pr_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export COMPONENT="insights-dashboard-frontend"
export IMAGE="quay.io/cloudservices/$COMPONENT"
export WORKSPACE=${WORKSPACE:-$APP_ROOT} # if running in jenkins, use the build's workspace
export APP_ROOT=$(pwd)
export NODE_BUILD_VERSION=18
cat /etc/redhat-release
COMMON_BUILDER=https://raw.githubusercontent.com/RedHatInsights/insights-frontend-builder-common/master

Expand Down
6 changes: 1 addition & 5 deletions src/Messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,11 +450,7 @@ export default defineMessages({
description: 'Learn more about Insights',
defaultMessage: 'Learn more about Insights'
},
insightsDescription: {
id: 'insightsDescription',
description: 'insights Description',
defaultMessage: 'Single, consistent management solution across on-premise, hybrid cloud, and public cloud. Included with Red Hat Enterprise Linux subscription. Single, consistent management solution across on-premise, hybrid cloud, and public cloud.'
},
insightsDescription: 'Single, consistent management solution across on-premise, hybrid cloud, and public cloud. Included with Red Hat Enterprise Linux subscription. Single, consistent management solution across on-premise, hybrid cloud, and public cloud.',
contactsales: {
id: 'contactsales',
description: 'Contact sales',
Expand Down
4 changes: 2 additions & 2 deletions src/PresentationalComponents/ZeroState/AppZeroState.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ZeroStateFooter from './ZeroStateFooter';
import propTypes from 'prop-types';
import { IntlProvider } from '@redhat-cloud-services/frontend-components-translations';
import { useAxiosWithPlatformInterceptors } from '@redhat-cloud-services/frontend-components-utilities/interceptors';
import zeroStateAppList from './zeroStateConstants';
import { createAppNamesList } from './zeroStateHelpers';

const standardApiReq = '/api/inventory/v1/hosts?page=1&per_page=1';

Expand Down Expand Up @@ -75,7 +75,7 @@ const AppZeroState = ({

export default AppZeroState;

const appNames = Object.keys(zeroStateAppList).map(key => key.split('_')[0]);
const appNames = createAppNamesList();

AppZeroState.propTypes = {
children: propTypes.any,
Expand Down
4 changes: 2 additions & 2 deletions src/PresentationalComponents/ZeroState/AppZeroState.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React from 'react';
import AppZeroState from './AppZeroState';
import { MemoryRouter, Route, Routes } from 'react-router-dom';
import { useAxiosWithPlatformInterceptors } from '@redhat-cloud-services/frontend-components-utilities/interceptors';
import zeroStateAppList from './zeroStateConstants';
import { createAppNamesList } from './zeroStateHelpers';

jest.mock('@redhat-cloud-services/frontend-components-utilities/interceptors', () => ({
__esModule: true,
Expand All @@ -14,7 +14,7 @@ jest.mock('@redhat-cloud-services/frontend-components-utilities/interceptors', (
}))
}));

const appNames = Object.keys(zeroStateAppList).map(key => key.split('_')[0]);
const appNames = createAppNamesList();
const randomApp = appNames[Math.floor(Math.random() * appNames.length)];

describe('AppZeroState component', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/PresentationalComponents/ZeroState/ZeroStateBanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ import zeroStateConstants from './zeroStateConstants';

const ZeroStateBanner = ({
appName,
description = zeroStateConstants[`${appName.toUpperCase()}_ZERO_STATE`].header.description,
commands = zeroStateConstants[`${appName.toUpperCase()}_ZERO_STATE`].header.commands,
bulletPoints = zeroStateConstants[`${appName.toUpperCase()}_ZERO_STATE`].header.bulletPoints,
customInstructions,
customButton,
customText,
customTitle,
appId
}) => {
const description = zeroStateConstants[`${appName.toUpperCase()}_ZERO_STATE`].header.description;
const commands = zeroStateConstants[`${appName.toUpperCase()}_ZERO_STATE`].header.commands;
const bulletPoints = zeroStateConstants[`${appName.toUpperCase()}_ZERO_STATE`].header.bulletPoints;
const intl = useIntl();
const { hideGlobalFilter } = useChrome();

Expand Down
3 changes: 2 additions & 1 deletion src/PresentationalComponents/ZeroState/zeroStateConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ const INSIGHTS_ZERO_STATE = {
],
bulletPoints: ['What problems do we solve', 'What solution do we provide']
},
otherApps: {}
otherApps: [],
documentation: []
};

const CONTENT_MANAGEMENT_ZERO_STATE = {
Expand Down
5 changes: 5 additions & 0 deletions src/PresentationalComponents/ZeroState/zeroStateHelpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import zeroStateAppList from './zeroStateConstants';

export const createAppNamesList = () => {
return Object.keys(zeroStateAppList).map(key => key.replace('_ZERO_STATE', ''));
};

0 comments on commit 5e52f86

Please sign in to comment.