PromoteRc component rename

Signed-off-by: Erik Engervall <erik.engervall@gmail.com>
This commit is contained in:
Erik Engervall
2021-04-20 22:04:02 +02:00
parent c6efd515ae
commit 88c9eac54d
8 changed files with 58 additions and 16 deletions
@@ -46,8 +46,55 @@ describe('Cards', () => {
await waitFor(() => getByTestId(TEST_IDS.info.info));
});
expect(getByTestId(TEST_IDS.info.info).innerHTML).toMatchInlineSnapshot(
`"<h6 class=\\"MuiTypography-root MuiTypography-h6\\">Terminology</h6><p class=\\"MuiTypography-root MuiTypography-body1\\"><strong>GitHub</strong>: The source control system where releases reside in a practical sense. Read more about <a class=\\"MuiTypography-root MuiLink-root MuiLink-underlineHover MuiTypography-colorPrimary\\" href=\\"https://docs.github.com/en/github/administering-a-repository/managing-releases-in-a-repository\\" target=\\"_blank\\">GitHub releases</a>. (Note that this plugin works just as well with GitHub Enterprise.)</p><p class=\\"MuiTypography-root MuiTypography-body1\\"><strong>Release Candidate</strong>: A GitHub <i>prerelease</i> intended primarily for internal testing</p><p class=\\"MuiTypography-root MuiTypography-body1\\"><strong>Release Version</strong>: A GitHub release intended for end users</p>"`,
);
expect(getByTestId(TEST_IDS.info.info)).toMatchInlineSnapshot(`
<div
data-testid="grm--info"
style="margin-bottom: 1em;"
>
<h6
class="MuiTypography-root MuiTypography-h6"
>
Terminology
</h6>
<p
class="MuiTypography-root MuiTypography-body1"
>
<strong>
GitHub
</strong>
: The source control system where releases reside in a practical sense. Read more about
<a
class="MuiTypography-root MuiLink-root MuiLink-underlineHover MuiTypography-colorPrimary"
href="https://docs.github.com/en/github/administering-a-repository/managing-releases-in-a-repository"
target="_blank"
>
GitHub releases
</a>
. (Note that this plugin works just as well with GitHub Enterprise.)
</p>
<p
class="MuiTypography-root MuiTypography-body1"
>
<strong>
Release Candidate
</strong>
: A GitHub
<i>
prerelease
</i>
intended primarily for internal testing
</p>
<p
class="MuiTypography-root MuiTypography-body1"
>
<strong>
Release Version
</strong>
: A GitHub release intended for end users
</p>
</div>
`);
});
});
@@ -23,7 +23,7 @@ import { CreateRc } from './CreateRc/CreateRc';
import { GitHubReleaseManagerProps } from '../GitHubReleaseManager';
import { Info } from './Info/Info';
import { Patch } from './Patch/Patch';
import { PromoteReleaseCandidate } from './PromoteReleaseCandidate/PromoteRc';
import { PromoteRc } from './PromoteRc/PromoteRc';
import { RefetchContext } from '../contexts/RefetchContext';
import { useGetGitHubBatchInfo } from '../hooks/useGetGitHubBatchInfo';
import { usePluginApiClientContext } from '../contexts/PluginApiClientContext';
@@ -111,7 +111,7 @@ export function Cards({
)}
{!components?.promoteRc?.omit && (
<PromoteReleaseCandidate
<PromoteRc
latestRelease={gitHubBatchInfo.value.latestRelease}
successCb={components?.promoteRc?.successCb}
/>
@@ -29,13 +29,11 @@ jest.mock('./PromoteRcBody', () => ({
),
}));
import { PromoteReleaseCandidate } from './PromoteRc';
import { PromoteRc } from './PromoteRc';
describe('PromoteRc', () => {
it('return early if no latest release present', () => {
const { getByTestId } = render(
<PromoteReleaseCandidate latestRelease={null} />,
);
const { getByTestId } = render(<PromoteRc latestRelease={null} />);
expect(
getByTestId(TEST_IDS.components.noLatestRelease),
@@ -44,7 +42,7 @@ describe('PromoteRc', () => {
it('should display not-rc warning', () => {
const { getByTestId } = render(
<PromoteReleaseCandidate latestRelease={mockReleaseVersionCalver} />,
<PromoteRc latestRelease={mockReleaseVersionCalver} />,
);
expect(getByTestId(TEST_IDS.promoteRc.notRcWarning)).toBeInTheDocument();
@@ -52,7 +50,7 @@ describe('PromoteRc', () => {
it('should display PromoteRcBody', () => {
const { getByTestId } = render(
<PromoteReleaseCandidate latestRelease={mockReleaseCandidateCalver} />,
<PromoteRc latestRelease={mockReleaseCandidateCalver} />,
);
expect(
@@ -26,15 +26,12 @@ import { PromoteRcBody } from './PromoteRcBody';
import { TEST_IDS } from '../../test-helpers/test-ids';
import { useStyles } from '../../styles/styles';
interface PromoteReleaseCandidateProps {
interface PromoteRcProps {
latestRelease: GetLatestReleaseResult;
successCb?: ComponentConfigPromoteRc['successCb'];
}
export const PromoteReleaseCandidate = ({
latestRelease,
successCb,
}: PromoteReleaseCandidateProps) => {
export const PromoteRc = ({ latestRelease, successCb }: PromoteRcProps) => {
const classes = useStyles();
function Body() {