From 06c408cffd10dbccfe0b18e721f12d3442abf64e Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Wed, 21 Apr 2021 18:11:11 +0200 Subject: [PATCH] Remove unused component NoReleaseBranch & improve tests for NoLatestRelease Signed-off-by: Erik Engervall --- .../src/cards/Cards.tsx | 8 ++++- .../src/components/NoLatestRelease.test.tsx | 35 ++++++++++++++++--- .../src/components/NoReleaseBranch.test.tsx | 31 ---------------- .../src/components/NoReleaseBranch.tsx | 35 ------------------- .../src/test-helpers/test-ids.test.ts | 1 - .../src/test-helpers/test-ids.ts | 1 - 6 files changed, 37 insertions(+), 74 deletions(-) delete mode 100644 plugins/github-release-manager/src/components/NoReleaseBranch.test.tsx delete mode 100644 plugins/github-release-manager/src/components/NoReleaseBranch.tsx diff --git a/plugins/github-release-manager/src/cards/Cards.tsx b/plugins/github-release-manager/src/cards/Cards.tsx index 3463ffa2e3..22d7a8e884 100644 --- a/plugins/github-release-manager/src/cards/Cards.tsx +++ b/plugins/github-release-manager/src/cards/Cards.tsx @@ -90,7 +90,13 @@ export function Cards({ {!gitHubBatchInfo.value.latestRelease && ( - This repository has not releases yet + This repository doesn't have any releases yet + + )} + + {!gitHubBatchInfo.value.releaseBranch && ( + + This repository doesn't have any release branches )} diff --git a/plugins/github-release-manager/src/components/NoLatestRelease.test.tsx b/plugins/github-release-manager/src/components/NoLatestRelease.test.tsx index 779412ec25..1c2ea3ffa3 100644 --- a/plugins/github-release-manager/src/components/NoLatestRelease.test.tsx +++ b/plugins/github-release-manager/src/components/NoLatestRelease.test.tsx @@ -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(); + const { container } = render(); - expect( - getByTestId(TEST_IDS.components.noLatestRelease), - ).toBeInTheDocument(); + expect(container).toMatchInlineSnapshot(` +
+ +
+ `); }); }); diff --git a/plugins/github-release-manager/src/components/NoReleaseBranch.test.tsx b/plugins/github-release-manager/src/components/NoReleaseBranch.test.tsx deleted file mode 100644 index 6e31be3caa..0000000000 --- a/plugins/github-release-manager/src/components/NoReleaseBranch.test.tsx +++ /dev/null @@ -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(); - - expect( - getByTestId(TEST_IDS.components.noReleaseBranch), - ).toBeInTheDocument(); - }); -}); diff --git a/plugins/github-release-manager/src/components/NoReleaseBranch.tsx b/plugins/github-release-manager/src/components/NoReleaseBranch.tsx deleted file mode 100644 index 66c7f61ec0..0000000000 --- a/plugins/github-release-manager/src/components/NoReleaseBranch.tsx +++ /dev/null @@ -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 ( - - Unable to find any Release Branch - - ); -}; diff --git a/plugins/github-release-manager/src/test-helpers/test-ids.test.ts b/plugins/github-release-manager/src/test-helpers/test-ids.test.ts index 2c1195b52e..091f2ccb90 100644 --- a/plugins/github-release-manager/src/test-helpers/test-ids.test.ts +++ b/plugins/github-release-manager/src/test-helpers/test-ids.test.ts @@ -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", diff --git a/plugins/github-release-manager/src/test-helpers/test-ids.ts b/plugins/github-release-manager/src/test-helpers/test-ids.ts index 52a426c9b8..e7d3240a8b 100644 --- a/plugins/github-release-manager/src/test-helpers/test-ids.ts +++ b/plugins/github-release-manager/src/test-helpers/test-ids.ts @@ -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',