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
Changes from 1 commit
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
Next Next commit
fix: change all UI rendered githubs to GitHub
  • Loading branch information
sashaboi committed May 27, 2024
commit 708db2eea42ecaf955ba4a9bf935d48330568598
Original file line number Diff line number Diff line change
@@ -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 (
@@ -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>
)
Original file line number Diff line number Diff line change
@@ -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>
)
Original file line number Diff line number Diff line change
@@ -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()
})
@@ -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()
})
Original file line number Diff line number Diff line change
@@ -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>
)
}

Original file line number Diff line number Diff line change
@@ -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()
})
2 changes: 1 addition & 1 deletion src/pages/CommitDetailPage/Header/PullLabel/PullLabel.jsx
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
@@ -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',
Original file line number Diff line number Diff line change
@@ -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>
4 changes: 2 additions & 2 deletions src/pages/SyncProviderPage/SyncButton.spec.tsx
Original file line number Diff line number Diff line change
@@ -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()
@@ -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')
4 changes: 2 additions & 2 deletions src/pages/SyncProviderPage/SyncButton.tsx
Original file line number Diff line number Diff line change
@@ -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>
)
2 changes: 1 addition & 1 deletion src/pages/SyncProviderPage/SyncProviderPage.spec.tsx
Original file line number Diff line number Diff line change
@@ -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()
})

8 changes: 4 additions & 4 deletions src/services/navigation/useNavLinks/useStaticNavLinks.js
Original file line number Diff line number Diff line change
@@ -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: {
@@ -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,
10 changes: 5 additions & 5 deletions src/shared/utils/provider.js
Original file line number Diff line number Diff line change
@@ -5,18 +5,18 @@ 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',
gh: forRender ? 'GitHub' : 'Github',
bb: 'BitBucket',
gl: 'Gitlab',
ghe: 'Github Enterprise',
ghe: forRender ? 'GitHub Enterprise' : 'Github Enterprise',
gle: 'Gitlab Enterprise',
bbs: 'BitBucket Server',
github: 'Github',
github: forRender ? 'GitHub' : 'Github',
bitbucket: 'BitBucket',
gitlab: 'Gitlab',
github_enterprise: 'Github Enterprise',
github_enterprise: forRender ? 'GitHub Enterprise' : 'Github Enterprise',
gitlab_enterprise: 'Gitlab Enterprise',
bitbucket_server: 'BitBucket Server',
}[provider.toLowerCase()]
12 changes: 12 additions & 0 deletions src/shared/utils/provider.spec.js
Original file line number Diff line number Diff line change
@@ -18,6 +18,12 @@ describe('providerToName', () => {
})
})

describe('when called with gh and for render', () => {
it('returns GitHub', () => {
expect(providerToName('gh', true)).toBe('GitHub')
})
})

describe('when called with gl', () => {
it('returns Gitlab', () => {
expect(providerToName('gl')).toBe('Gitlab')
@@ -54,6 +60,12 @@ describe('providerToName', () => {
})
})

describe('when called with Github and for Render', () => {
it('returns GitHub', () => {
expect(providerToName('github', true)).toBe('GitHub')
})
})

describe('when called with Gitlab', () => {
it('returns Gitlab', () => {
expect(providerToName('gitlab')).toBe('Gitlab')