Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Od/chore/casing for git provider #2901

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function GithubIntegrationCopy({ integrationId }) {
return (
<p>
This account is configured via the GitHub App. You can manage the apps
repository integration on <A to={{ pageName: 'github' }}>Github.</A>
repository integration on <A to={{ pageName: 'github' }}>GitHub.</A>
</p>
)
return (
Expand Down Expand Up @@ -47,7 +47,7 @@ function GithubIntegrationSection() {

return (
<div className="flex flex-col gap-2">
<h2 className="text-lg font-semibold">Github Integration</h2>
<h2 className="text-lg font-semibold">GitHub Integration</h2>
<GithubIntegrationCopy integrationId={accountDetails?.integrationId} />
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export default function AdminTable() {
if (!isLoading && !tableData?.length) {
return (
<p>
No admins yet. Note that admins in your Github organization are
No admins yet. Note that admins in your GitHub organization are
automatically considered admins.
</p>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe('ManageAdminCard', () => {
render(<ManageAdminCard />, { wrapper })

const noAdmins = await screen.findByText(
/No admins yet. Note that admins in your Github organization are automatically considered admins./
/No admins yet. Note that admins in your GitHub organization are automatically considered admins./
)
expect(noAdmins).toBeInTheDocument()
})
Expand All @@ -129,7 +129,7 @@ describe('ManageAdminCard', () => {
render(<ManageAdminCard />, { wrapper })

const noAdmins = await screen.findByText(
/No admins yet. Note that admins in your Github organization are automatically considered admins./
/No admins yet. Note that admins in your GitHub organization are automatically considered admins./
)
expect(noAdmins).toBeInTheDocument()
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const BotErrorHeading = () => {

if (ghWithApp) {
return (
<p className="font-semibold">There was an issue with the Github app</p>
<p className="font-semibold">There was an issue with the GitHub app</p>
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('BotErrorBanner', () => {
})

const title = await screen.findByText(
'There was an issue with the Github app'
'There was an issue with the GitHub app'
)
expect(title).toBeInTheDocument()
})
Expand Down
2 changes: 1 addition & 1 deletion src/pages/CommitDetailPage/Header/PullLabel/PullLabel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function PullLabel({ pullId, provider, providerPullUrl }) {
</span>
<A to={{ pageName: 'pullDetail', options: { pullId } }}>#{pullId}</A> (
<A href={providerPullUrl} hook="provider url" isExternal={true}>
{providerToName(provider)}
{providerToName(provider, true)}
</A>
)
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('PullLabel', () => {
it('renders provider pull url', async () => {
render(<PullLabel {...mockValidProps} />, { wrapper })

const pullUrlLink = await screen.findByRole('link', { name: /Github/ })
const pullUrlLink = await screen.findByRole('link', { name: /GitHub/ })
expect(pullUrlLink).toBeInTheDocument()
expect(pullUrlLink).toHaveAttribute(
'href',
Expand Down
1 change: 0 additions & 1 deletion src/pages/LoginPage/LoginButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {

function LoginButton({ provider }) {
const { signIn } = useNavLinks()

const to = `${window.location.protocol}//${window.location.host}/${provider}`
const providerName = loginProviderToName(provider)
const providerImage = loginProviderImage(provider)
Expand Down
8 changes: 4 additions & 4 deletions src/pages/LoginPage/LoginButton.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('LoginButton', () => {
}),
})

const bitbucket = screen.getByText(/Login with Bitbucket/i)
const bitbucket = screen.getByText(/Login with Bitbucket/)
expect(bitbucket).toBeInTheDocument()
})
})
Expand All @@ -40,7 +40,7 @@ describe('LoginButton', () => {
}),
})

const github = screen.getByText(/Login with GitHub/i)
const github = screen.getByText(/Login with GitHub/)
expect(github).toBeInTheDocument()
})
})
Expand All @@ -54,7 +54,7 @@ describe('LoginButton', () => {
}),
})

const gitlab = screen.getByText(/Login with GitLab/i)
const gitlab = screen.getByText(/Login with GitLab/)
expect(gitlab).toBeInTheDocument()
})
})
Expand All @@ -68,7 +68,7 @@ describe('LoginButton', () => {
}),
})

const sentry = screen.getByText(/Login with Sentry/i)
const sentry = screen.getByText(/Login with Sentry/)
expect(sentry).toBeInTheDocument()
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function ActionsBilling() {
<div className="flex flex-col gap-4 border-ds-gray-secondary">
<hr />
<div className="flex gap-4">
<img className="h-8 w-8" alt="Github" src={githubLogo} />
<img className="h-8 w-8" alt="GitHub" src={githubLogo} />
<p className="text-sm">
Your account is configured via GitHub Marketplace
</p>
Expand Down
12 changes: 6 additions & 6 deletions src/pages/SyncProviderPage/SyncButton.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('SyncButton', () => {
it('renders sync button', () => {
render(<SyncButton provider="gh" />, { wrapper })

const link = screen.getByRole('link', { name: /Sync with Github/ })
const link = screen.getByRole('link', { name: /Sync with GitHub/ })

const expectedRedirect = encodeURIComponent('http://localhost/gh')
expect(link).toBeInTheDocument()
Expand All @@ -26,7 +26,7 @@ describe('SyncButton', () => {
it('renders sync button', () => {
render(<SyncButton provider="gl" />, { wrapper })

const link = screen.getByRole('link', { name: /Sync with Gitlab/ })
const link = screen.getByRole('link', { name: /Sync with GitLab/ })

const expectedRedirect = encodeURIComponent('http://localhost/gl')
expect(link).toBeInTheDocument()
Expand All @@ -38,7 +38,7 @@ describe('SyncButton', () => {
it('renders sync button', () => {
render(<SyncButton provider="bb" />, { wrapper })

const link = screen.getByRole('link', { name: /Sync with BitBucket/ })
const link = screen.getByRole('link', { name: /Sync with Bitbucket/ })

const expectedRedirect = encodeURIComponent('http://localhost/bb')
expect(link).toBeInTheDocument()
Expand All @@ -51,7 +51,7 @@ describe('SyncButton', () => {
render(<SyncButton provider="ghe" />, { wrapper })

const link = screen.getByRole('link', {
name: /Sync with Github Enterprise/,
name: /Sync with GitHub Enterprise/,
})

const expectedRedirect = encodeURIComponent('http://localhost/ghe')
Expand All @@ -65,7 +65,7 @@ describe('SyncButton', () => {
render(<SyncButton provider="gle" />, { wrapper })

const link = screen.getByRole('link', {
name: /Sync with Gitlab Enterprise/,
name: /Sync with GitLab Enterprise/,
})

const expectedRedirect = encodeURIComponent('http://localhost/gle')
Expand All @@ -79,7 +79,7 @@ describe('SyncButton', () => {
render(<SyncButton provider="bbs" />, { wrapper })

const link = screen.getByRole('link', {
name: /Sync with BitBucket Server/,
name: /Sync with Bitbucket Server/,
})

const expectedRedirect = encodeURIComponent('http://localhost/bbs')
Expand Down
4 changes: 2 additions & 2 deletions src/pages/SyncProviderPage/SyncButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ const SyncButton: React.FC<SyncButtonProps> = ({ provider }) => {
data-cy={'login-button'}
>
<img
alt={`Logo of ${providerToName(provider)}`}
alt={`Logo of ${providerToName(provider, true)}`}
className="mx-4 block h-6 w-6"
src={providerImage(provider)}
/>
Sync with {providerToName(provider)}
Sync with {providerToName(provider, true)}
</a>
</div>
)
Expand Down
4 changes: 2 additions & 2 deletions src/pages/SyncProviderPage/SyncProviderPage.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ describe('SyncProviderPage', () => {
setup()
render(<SyncProviderPage />, { wrapper })

const githubSyncButton = await screen.findByText(/Sync with Github/)
const githubSyncButton = await screen.findByText(/Sync with GitHub/)
expect(githubSyncButton).toBeInTheDocument()
})

Expand All @@ -138,7 +138,7 @@ describe('SyncProviderPage', () => {
render(<SyncProviderPage />, { wrapper })

const gheSyncButton = await screen.findByText(
/Sync with Gitlab Enterprise/
/Sync with GitLab Enterprise/
)
expect(gheSyncButton).toBeInTheDocument()
})
Expand Down
8 changes: 4 additions & 4 deletions src/services/navigation/useNavLinks/useStaticNavLinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,13 @@ export function useStaticNavLinks() {
codecovGithubApp: {
path: () => 'https://github.com/apps/codecov',
isExternalLink: true,
text: 'Codecov Github App',
text: 'Codecov GitHub App',
openNewTab: true,
},
codecovGithubAppSelectTarget: {
path: () => 'https://github.com/apps/codecov/installations/select_target',
isExternalLink: true,
text: 'Codecov Github App',
text: 'Codecov GitHub App',
openNewTab: true,
},
teamBot: {
Expand Down Expand Up @@ -366,14 +366,14 @@ export function useStaticNavLinks() {
openNewTab: true,
},
codecovExampleWorkflow: {
text: 'Github Codecov Example workflow',
text: 'GitHub Codecov Example workflow',
path: () =>
'https://github.com/codecov/example-python/blob/main/.github/workflows/ci.yml',
isExternalLink: true,
openNewTab: true,
},
codecovActionRepo: {
text: 'Github Codecov Action Repo',
text: 'GitHub Codecov Action Repo',
path: () => 'https://github.com/codecov/codecov-action',
isExternalLink: true,
openNewTab: true,
Expand Down
2 changes: 1 addition & 1 deletion src/shared/utils/loginProviders.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('loginProviderToName', () => {
describe('valid value is passed', () => {
it('returns the provider name', () => {
const data = loginProviderToName(LOGIN_PROVIDER_SHORT_NAMES.gh)
expect(data).toBe('Github')
expect(data).toBe('GitHub')
})
})

Expand Down
31 changes: 19 additions & 12 deletions src/shared/utils/loginProviders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,18 @@ export function loginProviderToShortName(loginProvider?: string) {
}

export const LOGIN_PROVIDER_NAMES = {
gh: 'Github',
bb: 'BitBucket',
gl: 'Gitlab',
ghe: 'Github Enterprise',
gle: 'Gitlab Enterprise',
bbs: 'BitBucket Server',
github: 'Github',
bitbucket: 'BitBucket',
gitlab: 'Gitlab',
github_enterprise: 'Github Enterprise',
gitlab_enterprise: 'Gitlab Enterprise',
bitbucket_server: 'BitBucket Server',
gh: 'GitHub',
bb: 'Bitbucket',
gl: 'GitLab',
ghe: 'GitHub Enterprise',
gle: 'GitLab Enterprise',
bbs: 'Bitbucket Server',
github: 'GitHub',
bitbucket: 'Bitbucket',
gitlab: 'GitLab',
github_enterprise: 'GitHub Enterprise',
gitlab_enterprise: 'GitLab Enterprise',
bitbucket_server: 'Bitbucket Server',
sentry: 'Sentry',
okta: 'Okta',
} as const
Expand All @@ -115,11 +115,18 @@ export function loginProviderToName(loginProvider?: string) {

export const LOGIN_PROVIDER_IMAGES = {
Github: githubLogo,
GitHub: githubLogo,
Gitlab: gitlabLogo,
GitLab: gitlabLogo,
BitBucket: bitbucketLogo,
Bitbucket: bitbucketLogo,
'Github Enterprise': githubLogo,
'GitHub Enterprise': githubLogo,
'Gitlab Enterprise': gitlabLogo,
'GitLab Enterprise': gitlabLogo,
'BitBucket Server': bitbucketLogo,
'Bitbucket Server': bitbucketLogo,

Sentry: sentryLogo,
Okta: oktaLogo,
} as const
Expand Down
26 changes: 13 additions & 13 deletions src/shared/utils/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ import bitbucketLogo from 'assets/providers/bitbucket-icon.svg'
import githubLogo from 'assets/providers/github-icon.svg'
import gitlabLogo from 'assets/providers/gitlab-icon.svg'

export function providerToName(provider) {
export function providerToName(provider, forRender = false) {
return {
gh: 'Github',
bb: 'BitBucket',
gl: 'Gitlab',
ghe: 'Github Enterprise',
gle: 'Gitlab Enterprise',
bbs: 'BitBucket Server',
github: 'Github',
bitbucket: 'BitBucket',
gitlab: 'Gitlab',
github_enterprise: 'Github Enterprise',
gitlab_enterprise: 'Gitlab Enterprise',
bitbucket_server: 'BitBucket Server',
gh: forRender ? 'GitHub' : 'Github',
bb: forRender ? 'Bitbucket' : 'BitBucket',
gl: forRender ? 'GitLab' : 'Gitlab',
ghe: forRender ? 'GitHub Enterprise' : 'Github Enterprise',
gle: forRender ? 'GitLab Enterprise' : 'Gitlab Enterprise',
bbs: forRender ? 'Bitbucket Server' : 'BitBucket Server',
github: forRender ? 'GitHub' : 'Github',
bitbucket: forRender ? 'Bitbucket' : 'BitBucket',
gitlab: forRender ? 'GitLab' : 'Gitlab',
github_enterprise: forRender ? 'GitHub Enterprise' : 'Github Enterprise',
gitlab_enterprise: forRender ? 'GitLab Enterprise' : 'Gitlab Enterprise',
bitbucket_server: forRender ? 'Bitbucket Server' : 'BitBucket Server',
}[provider.toLowerCase()]
}

Expand Down
Loading
Loading