diff --git a/plugins/github-release-manager/package.json b/plugins/github-release-manager/package.json index bd6939a128..cd32f0c105 100644 --- a/plugins/github-release-manager/package.json +++ b/plugins/github-release-manager/package.json @@ -39,12 +39,13 @@ "@backstage/dev-utils": "^0.1.13", "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", + "@testing-library/react-hooks": "^5.1.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^12.0.7", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", - "msw": "^0.21.2", - "cross-fetch": "^3.0.6" + "cross-fetch": "^3.0.6", + "msw": "^0.21.2" }, "files": [ "dist" diff --git a/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx b/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx index 172375f115..f3c55693dc 100644 --- a/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx +++ b/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx @@ -42,7 +42,7 @@ import { GetLatestReleaseResult, GetRepositoryResult, } from '../../api/PluginApiClient'; -import { ResponseStepList2 } from '../../components/ResponseStepList/ResponseStepList2'; +import { ResponseStepList } from '../../components/ResponseStepList/ResponseStepList'; import { LinearProgressWithLabel } from '../../components/LinearProgressWithLabel'; interface CreateRcProps { @@ -90,7 +90,7 @@ export const CreateRc = ({ - + ); } diff --git a/plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.test.ts b/plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.test.ts deleted file mode 100644 index 8cecaf6fd5..0000000000 --- a/plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.test.ts +++ /dev/null @@ -1,65 +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 { - mockApiClient, - mockCalverProject, - mockDefaultBranch, - mockNextGitHubInfo, - mockReleaseVersionCalver, -} from '../../../test-helpers/test-helpers'; -import { useCreateRc } from './useCreateRc'; - -// TODO: Fix tests -/* eslint-disable jest/no-disabled-tests */ - -describe.skip('useCreateRc', () => { - beforeEach(jest.clearAllMocks); - - it('should work', () => { - const result = useCreateRc({ - defaultBranch: mockDefaultBranch, - latestRelease: mockReleaseVersionCalver, - nextGitHubInfo: mockNextGitHubInfo, - pluginApiClient: mockApiClient, - project: mockCalverProject, - }); - - expect(result).toMatchInlineSnapshot(` - Array [ - Object { - "link": "latestCommit.html_url", - "message": "Fetched latest commit from \\"mock_defaultBranch\\"", - "secondaryMessage": "with message \\"latestCommit.commit.message\\"", - }, - Object { - "message": "Cut Release Branch", - "secondaryMessage": "with ref \\"mock_createRef_ref\\"", - }, - Object { - "link": "mock_compareCommits_html_url", - "message": "Fetched commit comparison", - "secondaryMessage": "rc/1.2.3...rc/1.2.3", - }, - Object { - "link": "mock_createRelease_html_url", - "message": "Created Release Candidate \\"mock_createRelease_name\\"", - "secondaryMessage": "with tag \\"rc-1.2.3\\"", - }, - ] - `); - }); -}); diff --git a/plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.test.tsx b/plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.test.tsx new file mode 100644 index 0000000000..b0ce35a3ec --- /dev/null +++ b/plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.test.tsx @@ -0,0 +1,100 @@ +/* + * 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 { renderHook, act } from '@testing-library/react-hooks'; +import { waitFor } from '@testing-library/react'; + +import { + mockApiClient, + mockCalverProject, + mockDefaultBranch, + mockNextGitHubInfo, + mockReleaseVersionCalver, +} from '../../../test-helpers/test-helpers'; +import { useCreateRc } from './useCreateRc'; + +describe('useCreateRc', () => { + beforeEach(jest.clearAllMocks); + + it('should return the expected responseSteps and progress', async () => { + const { result } = renderHook(() => + useCreateRc({ + defaultBranch: mockDefaultBranch, + latestRelease: mockReleaseVersionCalver, + nextGitHubInfo: mockNextGitHubInfo, + pluginApiClient: mockApiClient, + project: mockCalverProject, + }), + ); + + await act(async () => { + await waitFor(() => result.current.run()); + }); + + expect(result.error).toEqual(undefined); + expect(result.current.responseSteps).toHaveLength(4); + }); + + it('should return the expected responseSteps and progress (with successCb)', async () => { + const { result } = renderHook(() => + useCreateRc({ + defaultBranch: mockDefaultBranch, + latestRelease: mockReleaseVersionCalver, + nextGitHubInfo: mockNextGitHubInfo, + pluginApiClient: mockApiClient, + project: mockCalverProject, + successCb: jest.fn(), + }), + ); + + await act(async () => { + await waitFor(() => result.current.run()); + }); + + expect(result.current.responseSteps).toHaveLength(5); + expect(result.current).toMatchInlineSnapshot(` + Object { + "progress": 100, + "responseSteps": Array [ + Object { + "link": "latestCommit.html_url", + "message": "Fetched latest commit from \\"mock_defaultBranch\\"", + "secondaryMessage": "with message \\"latestCommit.commit.message\\"", + }, + Object { + "message": "Cut Release Branch", + "secondaryMessage": "with ref \\"mock_createRef_ref\\"", + }, + Object { + "link": "mock_compareCommits_html_url", + "message": "Fetched commit comparison", + "secondaryMessage": "rc/1.2.3...rc/1.2.3", + }, + Object { + "link": "mock_createRelease_html_url", + "message": "Created Release Candidate \\"mock_createRelease_name\\"", + "secondaryMessage": "with tag \\"rc-1.2.3\\"", + }, + Object { + "icon": "success", + "message": "Success callback successfully called 🚀", + }, + ], + "run": [Function], + } + `); + }); +}); diff --git a/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx b/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx index 3f62c1a262..f9a8babb5d 100644 --- a/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx +++ b/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx @@ -34,7 +34,7 @@ jest.mock('../../contexts/ProjectContext', () => ({ useProjectContext: jest.fn(() => mockCalverProject), })); jest.mock('./sideEffects/usePatch', () => ({ - useCreateRc: () => ({ + usePatch: () => ({ run: jest.fn(), responseSteps: [], progress: 0, @@ -44,10 +44,7 @@ jest.mock('./sideEffects/usePatch', () => ({ import { PatchBody } from './PatchBody'; import { TEST_IDS } from '../../test-helpers/test-ids'; -// TODO: Fix tests -/* eslint-disable jest/no-disabled-tests */ - -describe.skip('PatchBody', () => { +describe('PatchBody', () => { beforeEach(jest.clearAllMocks); it('should render error', async () => { diff --git a/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx b/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx index 0123363768..cd001c5110 100644 --- a/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx +++ b/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx @@ -51,7 +51,7 @@ import { } from '../../api/PluginApiClient'; import { GitHubReleaseManagerError } from '../../errors/GitHubReleaseManagerError'; import { LinearProgressWithLabel } from '../../components/LinearProgressWithLabel'; -import { ResponseStepList2 } from '../../components/ResponseStepList/ResponseStepList2'; +import { ResponseStepList } from '../../components/ResponseStepList/ResponseStepList'; interface PatchBodyProps { bumpedTag: string; @@ -109,7 +109,7 @@ export const PatchBody = ({ - + ); } diff --git a/plugins/github-release-manager/src/cards/patchRc/sideEffects/usePatch.test.ts b/plugins/github-release-manager/src/cards/patchRc/sideEffects/usePatch.test.ts index 17892c3c9d..ff280ed181 100644 --- a/plugins/github-release-manager/src/cards/patchRc/sideEffects/usePatch.test.ts +++ b/plugins/github-release-manager/src/cards/patchRc/sideEffects/usePatch.test.ts @@ -14,66 +14,106 @@ * limitations under the License. */ +import { renderHook, act } from '@testing-library/react-hooks'; +import { waitFor } from '@testing-library/react'; + import { mockApiClient, mockBumpedTag, mockCalverProject, mockReleaseVersionCalver, + mockSelectedPatchCommit, mockTagParts, } from '../../../test-helpers/test-helpers'; import { usePatch } from './usePatch'; -// TODO: Fix tests -/* eslint-disable jest/no-disabled-tests */ - -describe.skip('patch', () => { +describe('patch', () => { beforeEach(jest.clearAllMocks); - it('should work', async () => { - const result = await usePatch({ - bumpedTag: mockBumpedTag, - latestRelease: mockReleaseVersionCalver, - pluginApiClient: mockApiClient, - project: mockCalverProject, - tagParts: mockTagParts, + it('should return the expected responseSteps and progress', async () => { + const { result } = renderHook(() => + usePatch({ + bumpedTag: mockBumpedTag, + latestRelease: mockReleaseVersionCalver, + pluginApiClient: mockApiClient, + project: mockCalverProject, + tagParts: mockTagParts, + }), + ); + + await act(async () => { + await waitFor(() => result.current.run(mockSelectedPatchCommit)); }); - expect(result).toMatchInlineSnapshot(` - Array [ - Object { - "link": "mock_branch_links_html", - "message": "Fetched release branch \\"rc/1.2.3\\"", - }, - Object { - "message": "Created temporary commit", - "secondaryMessage": "with message \\"mock_commit_message\\"", - }, - Object { - "link": "mock_merge_html_url", - "message": "Merged temporary commit into \\"rc/1.2.3\\"", - "secondaryMessage": "with message \\"mock_merge_commit_message\\"", - }, - Object { - "message": "Cherry-picked patch commit to \\"mock_branch_commit_sha\\"", - "secondaryMessage": "with message \\"mock_cherrypick_message\\"", - }, - Object { - "message": "Updated reference \\"mock_reference_ref\\"", - }, - Object { - "message": "Created new tag object", - "secondaryMessage": "with name \\"mock_tag_object_tag\\"", - }, - Object { - "message": "Created new reference \\"mock_reference_ref\\"", - "secondaryMessage": "for tag object \\"mock_tag_object_tag\\"", - }, - Object { - "link": "mock_update_release_html_url", - "message": "Updated release \\"mock_update_release_name\\"", - "secondaryMessage": "with tag mock_update_release_tag_name", - }, - ] + expect(result.error).toEqual(undefined); + expect(result.current.responseSteps).toHaveLength(9); + }); + + it('should return the expected responseSteps and progress (with successCb)', async () => { + const { result } = renderHook(() => + usePatch({ + bumpedTag: mockBumpedTag, + latestRelease: mockReleaseVersionCalver, + pluginApiClient: mockApiClient, + project: mockCalverProject, + tagParts: mockTagParts, + successCb: jest.fn(), + }), + ); + + await act(async () => { + await waitFor(() => result.current.run(mockSelectedPatchCommit)); + }); + + expect(result.error).toEqual(undefined); + expect(result.current.responseSteps).toHaveLength(10); + expect(result.current).toMatchInlineSnapshot(` + Object { + "progress": 100, + "responseSteps": Array [ + Object { + "link": "mock_branch_links_html", + "message": "Fetched release branch \\"rc/1.2.3\\"", + }, + Object { + "message": "Created temporary commit", + "secondaryMessage": "with message \\"mock_commit_message\\"", + }, + Object { + "message": "Forced branch \\"rc/1.2.3\\" to temporary commit \\"mock_commit_sha\\"", + }, + Object { + "link": "mock_merge_html_url", + "message": "Merged temporary commit into \\"rc/1.2.3\\"", + "secondaryMessage": "with message \\"mock_merge_commit_message\\"", + }, + Object { + "message": "Cherry-picked patch commit to \\"mock_branch_commit_sha\\"", + "secondaryMessage": "with message \\"mock_cherrypick_message\\"", + }, + Object { + "message": "Updated reference \\"mock_reference_ref\\"", + }, + Object { + "message": "Created new tag object", + "secondaryMessage": "with name \\"mock_tag_object_tag\\"", + }, + Object { + "message": "Created new reference \\"mock_reference_ref\\"", + "secondaryMessage": "for tag object \\"mock_tag_object_tag\\"", + }, + Object { + "link": "mock_update_release_html_url", + "message": "Updated release \\"mock_update_release_name\\"", + "secondaryMessage": "with tag mock_update_release_tag_name", + }, + Object { + "icon": "success", + "message": "Success callback successfully called 🚀", + }, + ], + "run": [Function], + } `); }); }); diff --git a/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx b/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx index fa902a35f0..274d40e6dd 100644 --- a/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx +++ b/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx @@ -25,7 +25,7 @@ import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext import { useProjectContext } from '../../contexts/ProjectContext'; import { useStyles } from '../../styles/styles'; import { GetLatestReleaseResult } from '../../api/PluginApiClient'; -import { ResponseStepList2 } from '../../components/ResponseStepList/ResponseStepList2'; +import { ResponseStepList } from '../../components/ResponseStepList/ResponseStepList'; import { LinearProgressWithLabel } from '../../components/LinearProgressWithLabel'; interface PromoteRcBodyProps { @@ -54,7 +54,7 @@ export const PromoteRcBody = ({ rcRelease, successCb }: PromoteRcBodyProps) => { - + ); } diff --git a/plugins/github-release-manager/src/cards/promoteRc/sideEffects/usePromoteRc.test.ts b/plugins/github-release-manager/src/cards/promoteRc/sideEffects/usePromoteRc.test.ts index d1ef45d9d6..a055e4acd8 100644 --- a/plugins/github-release-manager/src/cards/promoteRc/sideEffects/usePromoteRc.test.ts +++ b/plugins/github-release-manager/src/cards/promoteRc/sideEffects/usePromoteRc.test.ts @@ -14,6 +14,9 @@ * limitations under the License. */ +import { renderHook, act } from '@testing-library/react-hooks'; +import { waitFor } from '@testing-library/react'; + import { mockApiClient, mockReleaseCandidateCalver, @@ -21,29 +24,59 @@ import { } from '../../../test-helpers/test-helpers'; import { usePromoteRc } from './usePromoteRc'; -// TODO: Fix tests -/* eslint-disable jest/no-disabled-tests */ - -describe.skip('usePromoteRc', () => { +describe('usePromoteRc', () => { beforeEach(jest.clearAllMocks); - it('should work', () => { - const result = usePromoteRc({ - pluginApiClient: mockApiClient, - project: mockSemverProject, - rcRelease: mockReleaseCandidateCalver, - releaseVersion: 'version-1.2.3', - successCb: jest.fn(), + it('should return the expected responseSteps and progress', async () => { + const { result } = renderHook(() => + usePromoteRc({ + pluginApiClient: mockApiClient, + project: mockSemverProject, + rcRelease: mockReleaseCandidateCalver, + releaseVersion: 'version-1.2.3', + }), + ); + + await act(async () => { + await waitFor(() => result.current.run()); }); - expect(result).toMatchInlineSnapshot(` - Array [ - Object { - "link": "mock_release_html_url", - "message": "Promoted \\"mock_release_name\\"", - "secondaryMessage": "from \\"rc-2020.01.01_1\\" to \\"mock_release_tag_name\\"", - }, - ] + expect(result.error).toEqual(undefined); + expect(result.current.responseSteps).toHaveLength(1); + }); + + it('should return the expected responseSteps and progress (with successCb)', async () => { + const { result } = renderHook(() => + usePromoteRc({ + pluginApiClient: mockApiClient, + project: mockSemverProject, + rcRelease: mockReleaseCandidateCalver, + releaseVersion: 'version-1.2.3', + successCb: jest.fn(), + }), + ); + + await act(async () => { + await waitFor(() => result.current.run()); + }); + + expect(result.current.responseSteps).toHaveLength(2); + expect(result.current).toMatchInlineSnapshot(` + Object { + "progress": 100, + "responseSteps": Array [ + Object { + "link": "mock_release_html_url", + "message": "Promoted \\"mock_release_name\\"", + "secondaryMessage": "from \\"rc-2020.01.01_1\\" to \\"mock_release_tag_name\\"", + }, + Object { + "icon": "success", + "message": "Success callback successfully called 🚀", + }, + ], + "run": [Function], + } `); }); }); diff --git a/plugins/github-release-manager/src/components/ReloadButton.test.tsx b/plugins/github-release-manager/src/components/ReloadButton.test.tsx deleted file mode 100644 index b33cc0b931..0000000000 --- a/plugins/github-release-manager/src/components/ReloadButton.test.tsx +++ /dev/null @@ -1,29 +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 { ReloadButton } from './ReloadButton'; - -describe('ReloadButton', () => { - it('render ReloadButton', () => { - const { getByTestId } = render(); - - expect(getByTestId(TEST_IDS.components.reloadButton)).toBeInTheDocument(); - }); -}); diff --git a/plugins/github-release-manager/src/components/ReloadButton.tsx b/plugins/github-release-manager/src/components/ReloadButton.tsx deleted file mode 100644 index d11f39f954..0000000000 --- a/plugins/github-release-manager/src/components/ReloadButton.tsx +++ /dev/null @@ -1,36 +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 { Button } from '@material-ui/core'; - -import { TEST_IDS } from '../test-helpers/test-ids'; - -interface ReloadButtonProps { - style?: React.CSSProperties; -} - -export const ReloadButton = ({ style }: ReloadButtonProps) => ( - -); diff --git a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.test.tsx b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.test.tsx index cfa68b0c32..21f6c6925e 100644 --- a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.test.tsx +++ b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.test.tsx @@ -27,7 +27,7 @@ jest.mock('../../contexts/RefetchContext', () => ({ describe('ResponseStepList', () => { it('should render loading state when loading', () => { const { getByTestId } = render( - , + , ); expect( @@ -37,7 +37,7 @@ describe('ResponseStepList', () => { it('should render loading state when no responseSteps', () => { const { getByTestId } = render( - , + , ); expect( @@ -49,8 +49,7 @@ describe('ResponseStepList', () => { const { getByTestId } = render( , ); diff --git a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx index c3b84487f3..e703f08d34 100644 --- a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx +++ b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx @@ -15,14 +15,7 @@ */ import React, { PropsWithChildren } from 'react'; -import { - Button, - Dialog, - DialogActions, - DialogContent, - DialogTitle, - List, -} from '@material-ui/core'; +import { Button, DialogActions, DialogContent, List } from '@material-ui/core'; import { CenteredCircularProgress } from '../CenteredCircularProgress'; import { ResponseStep } from '../../types/types'; @@ -31,10 +24,9 @@ import { TEST_IDS } from '../../test-helpers/test-ids'; import { useRefetchContext } from '../../contexts/RefetchContext'; interface ResponseStepListProps { - responseSteps?: (ResponseStep | undefined)[]; - title: string; + responseSteps: (ResponseStep | undefined)[]; animationDelay?: number; - loading: boolean; + loading?: boolean; closeable?: boolean; denseList?: boolean; } @@ -44,16 +36,13 @@ export const ResponseStepList = ({ animationDelay, loading = false, denseList = false, - title, children, }: PropsWithChildren) => { const { setRefetchTrigger } = useRefetchContext(); return ( - - {title} - - {loading || !responseSteps ? ( + <> + {loading || responseSteps.length === 0 ? (
)} -
+ ); }; diff --git a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList2.tsx b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList2.tsx deleted file mode 100644 index 7239d223bb..0000000000 --- a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList2.tsx +++ /dev/null @@ -1,91 +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, { PropsWithChildren } from 'react'; -import { Button, DialogActions, DialogContent, List } from '@material-ui/core'; - -import { CenteredCircularProgress } from '../CenteredCircularProgress'; -import { ResponseStep } from '../../types/types'; -import { ResponseStepListItem } from './ResponseStepListItem'; -import { TEST_IDS } from '../../test-helpers/test-ids'; -import { useRefetchContext } from '../../contexts/RefetchContext'; - -interface ResponseStepListProps { - responseSteps?: (ResponseStep | undefined)[]; - animationDelay?: number; - loading?: boolean; - closeable?: boolean; - denseList?: boolean; -} - -// TODO: Replace `ResponseStepList` with this component - -export const ResponseStepList2 = ({ - responseSteps, - animationDelay, - loading = false, - denseList = false, - children, -}: PropsWithChildren) => { - const { setRefetchTrigger } = useRefetchContext(); - - return ( - <> - {loading || !responseSteps ? ( -
- -
- ) : ( - <> - - - {responseSteps.map((responseStep, index) => { - if (!responseStep) { - return null; - } - - return ( - - ); - })} - - - {children} - - - - - - )} - - ); -}; diff --git a/plugins/github-release-manager/src/hooks/useQueryHandler.test.tsx b/plugins/github-release-manager/src/hooks/useQueryHandler.test.tsx index 757bca9859..a80fa3df04 100644 --- a/plugins/github-release-manager/src/hooks/useQueryHandler.test.tsx +++ b/plugins/github-release-manager/src/hooks/useQueryHandler.test.tsx @@ -48,9 +48,9 @@ describe('useQueryHandler', () => { it('should get parsedQuery and queryParams', () => { const { getByTestId } = render(); - const smt = getByTestId(TEST_ID).innerHTML; + const result = getByTestId(TEST_ID).innerHTML; - expect(smt).toMatchInlineSnapshot(` + expect(result).toMatchInlineSnapshot(` "{ \\"parsedQuery\\": { \\"versioningStrategy\\": \\"semver\\", 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 5f537803ca..52a426c9b8 100644 --- a/plugins/github-release-manager/src/test-helpers/test-ids.ts +++ b/plugins/github-release-manager/src/test-helpers/test-ids.ts @@ -54,7 +54,6 @@ export const TEST_IDS = { }, components: { divider: 'grm--divider', - reloadButton: 'grm--reload-button', noLatestRelease: 'grm--no-latest-release', noReleaseBranch: 'grm--no-release-branch', circularProgress: 'grm--circular-progress', diff --git a/yarn.lock b/yarn.lock index 90072e3f79..43cc98ce87 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5550,6 +5550,18 @@ "@babel/runtime" "^7.5.4" "@types/testing-library__react-hooks" "^3.4.0" +"@testing-library/react-hooks@^5.1.1": + version "5.1.1" + resolved "https://registry.npmjs.org/@testing-library/react-hooks/-/react-hooks-5.1.1.tgz#1fbaae8a4e8a4a7f97b176c23e1e890c41bbbfa5" + integrity sha512-52D2XnpelFDefnWpy/V6z2qGNj8JLIvW5DjYtelMvFXdEyWiykSaI7IXHwFy4ICoqXJDmmwHAiFRiFboub/U5g== + dependencies: + "@babel/runtime" "^7.12.5" + "@types/react" ">=16.9.0" + "@types/react-dom" ">=16.9.0" + "@types/react-test-renderer" ">=16.9.0" + filter-console "^0.1.1" + react-error-boundary "^3.1.0" + "@testing-library/react@^11.2.5": version "11.2.6" resolved "https://registry.npmjs.org/@testing-library/react/-/react-11.2.6.tgz#586a23adc63615985d85be0c903f374dab19200b" @@ -6483,6 +6495,13 @@ "@types/webpack" "*" "@types/webpack-dev-server" "*" +"@types/react-dom@>=16.9.0": + version "17.0.3" + resolved "https://registry.npmjs.org/@types/react-dom/-/react-dom-17.0.3.tgz#7fdf37b8af9d6d40127137865bb3fff8871d7ee1" + integrity sha512-4NnJbCeWE+8YBzupn/YrJxZ8VnjcJq5iR1laqQ1vkpQgBiA7bwk0Rp24fxsdNinzJY2U+HHS4dJJDPdoMjdJ7w== + dependencies: + "@types/react" "*" + "@types/react-dom@^16.9.8": version "16.9.8" resolved "https://registry.npmjs.org/@types/react-dom/-/react-dom-16.9.8.tgz#fe4c1e11dfc67155733dfa6aa65108b4971cb423" @@ -6526,6 +6545,13 @@ dependencies: "@types/react" "*" +"@types/react-test-renderer@>=16.9.0": + version "17.0.1" + resolved "https://registry.npmjs.org/@types/react-test-renderer/-/react-test-renderer-17.0.1.tgz#3120f7d1c157fba9df0118dae20cb0297ee0e06b" + integrity sha512-3Fi2O6Zzq/f3QR9dRnlnHso9bMl7weKCviFmfF6B4LS1Uat6Hkm15k0ZAQuDz+UBq6B3+g+NM6IT2nr5QgPzCw== + dependencies: + "@types/react" "*" + "@types/react-text-truncate@^0.14.0": version "0.14.0" resolved "https://registry.npmjs.org/@types/react-text-truncate/-/react-text-truncate-0.14.0.tgz#588bbabbc7f2a13815e805f3a48942db73fe65fe" @@ -6562,6 +6588,15 @@ dependencies: csstype "^2.2.0" +"@types/react@>=16.9.0": + version "17.0.3" + resolved "https://registry.npmjs.org/@types/react/-/react-17.0.3.tgz#ba6e215368501ac3826951eef2904574c262cc79" + integrity sha512-wYOUxIgs2HZZ0ACNiIayItyluADNbONl7kt8lkLjVK8IitMH5QMyAh75Fwhmo37r1m7L2JaFj03sIfxBVDvRAg== + dependencies: + "@types/prop-types" "*" + "@types/scheduler" "*" + csstype "^3.0.2" + "@types/reactcss@*": version "1.2.3" resolved "https://registry.npmjs.org/@types/reactcss/-/reactcss-1.2.3.tgz#af28ae11bbb277978b99d04d1eedfd068ca71834" @@ -6643,6 +6678,11 @@ "@types/node" "*" rollup "^0.63.4" +"@types/scheduler@*": + version "0.16.1" + resolved "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.1.tgz#18845205e86ff0038517aab7a18a62a6b9f71275" + integrity sha512-EaCxbanVeyxDRTQBkdLb3Bvl/HK7PBK6UJjsSixB0iHKoWxE5uu2Q/DgtpOhPIojN0Zl1whvOd7PoHs2P0s5eA== + "@types/semver@^6.0.0": version "6.2.1" resolved "https://registry.npmjs.org/@types/semver/-/semver-6.2.1.tgz#a236185670a7860f1597cf73bea2e16d001461ba" @@ -13254,6 +13294,11 @@ fill-range@^7.0.1: dependencies: to-regex-range "^5.0.1" +filter-console@^0.1.1: + version "0.1.1" + resolved "https://registry.npmjs.org/filter-console/-/filter-console-0.1.1.tgz#6242be28982bba7415bcc6db74a79f4a294fa67c" + integrity sha512-zrXoV1Uaz52DqPs+qEwNJWJFAWZpYJ47UNmpN9q4j+/EYsz85uV0DC9k8tRND5kYmoVzL0W+Y75q4Rg8sRJCdg== + filter-obj@^1.1.0: version "1.1.0" resolved "https://registry.npmjs.org/filter-obj/-/filter-obj-1.1.0.tgz#9b311112bc6c6127a16e016c6c5d7f19e0805c5b" @@ -21909,6 +21954,13 @@ react-draggable@^4.0.3: classnames "^2.2.5" prop-types "^15.6.0" +react-error-boundary@^3.1.0: + version "3.1.1" + resolved "https://registry.npmjs.org/react-error-boundary/-/react-error-boundary-3.1.1.tgz#932c5ca5cbab8ec4fe37fd7b415aa5c3a47597e7" + integrity sha512-W3xCd9zXnanqrTUeViceufD3mIW8Ut29BUD+S2f0eO2XCOU8b6UrJfY46RDGe5lxCJzfe4j0yvIfh0RbTZhKJw== + dependencies: + "@babel/runtime" "^7.12.5" + react-error-overlay@^6.0.7, react-error-overlay@^6.0.9: version "6.0.9" resolved "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.9.tgz#3c743010c9359608c375ecd6bc76f35d93995b0a"