Remove unused component NoReleaseBranch & improve tests for NoLatestRelease

Signed-off-by: Erik Engervall <erik.engervall@gmail.com>
This commit is contained in:
Erik Engervall
2021-04-21 18:11:11 +02:00
parent 278dcdd92b
commit 06c408cffd
6 changed files with 37 additions and 74 deletions
@@ -90,7 +90,13 @@ export function Cards({
{!gitHubBatchInfo.value.latestRelease && (
<Alert severity="info" style={{ marginBottom: 20 }}>
This repository has not releases yet
This repository doesn't have any releases yet
</Alert>
)}
{!gitHubBatchInfo.value.releaseBranch && (
<Alert severity="info" style={{ marginBottom: 20 }}>
This repository doesn't have any release branches
</Alert>
)}
@@ -17,15 +17,40 @@
import React from 'react';
import { render } from '@testing-library/react';
import { TEST_IDS } from '../test-helpers/test-ids';
import { NoLatestRelease } from './NoLatestRelease';
describe('NoLatestRelease', () => {
it('render NoLatestRelease', () => {
const { getByTestId } = render(<NoLatestRelease />);
const { container } = render(<NoLatestRelease />);
expect(
getByTestId(TEST_IDS.components.noLatestRelease),
).toBeInTheDocument();
expect(container).toMatchInlineSnapshot(`
<div>
<div
class="MuiPaper-root MuiAlert-root MuiAlert-standardWarning makeStyles-paragraph-2 MuiPaper-elevation0"
data-testid="grm--no-latest-release"
role="alert"
>
<div
class="MuiAlert-icon"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"
/>
</svg>
</div>
<div
class="MuiAlert-message"
>
Unable to find any Release
</div>
</div>
</div>
`);
});
});
@@ -1,31 +0,0 @@
/*
* Copyright 2021 Spotify AB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { render } from '@testing-library/react';
import { TEST_IDS } from '../test-helpers/test-ids';
import { NoReleaseBranch } from './NoReleaseBranch';
describe('NoReleaseBranch', () => {
it('render NoReleaseBranch', () => {
const { getByTestId } = render(<NoReleaseBranch />);
expect(
getByTestId(TEST_IDS.components.noReleaseBranch),
).toBeInTheDocument();
});
});
@@ -1,35 +0,0 @@
/*
* Copyright 2021 Spotify AB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { Alert } from '@material-ui/lab';
import { useStyles } from '../styles/styles';
import { TEST_IDS } from '../test-helpers/test-ids';
export const NoReleaseBranch = () => {
const classes = useStyles();
return (
<Alert
data-testid={TEST_IDS.components.noReleaseBranch}
className={classes.paragraph}
severity="warning"
>
Unable to find any Release Branch
</Alert>
);
};
@@ -36,7 +36,6 @@ describe('test-ids', () => {
},
"divider": "grm--divider",
"noLatestRelease": "grm--no-latest-release",
"noReleaseBranch": "grm--no-release-branch",
"responseStepListDialogContent": "grm--response-step-list--dialog-content",
"responseStepListItem": "grm--response-step-list-item",
"responseStepListItemIconDefault": "grm--response-step-list-item--item-icon--default",
@@ -55,7 +55,6 @@ export const TEST_IDS = {
components: {
divider: 'grm--divider',
noLatestRelease: 'grm--no-latest-release',
noReleaseBranch: 'grm--no-release-branch',
circularProgress: 'grm--circular-progress',
responseStepListDialogContent: 'grm--response-step-list--dialog-content',
responseStepListItem: 'grm--response-step-list-item',