Skip to content

Commit

Permalink
fix: Only show GH config banner when no welcome banner (#3680)
Browse files Browse the repository at this point in the history
  • Loading branch information
calvin-codecov authored Jan 24, 2025
1 parent 53ce439 commit dfb4df6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/shared/ListRepo/ListRepo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ function ListRepo({ canRefetch, hasGhApp }) {

return (
<>
{!hasGhApp && <GithubConfigBanner />}
{/* we only want one of these two banners to show at a time */}
{!hasGhApp && !showDemoAlert && <GithubConfigBanner />}
<OrgControlTable
searchValue={params.search}
repoDisplay={repoDisplay}
Expand Down
18 changes: 15 additions & 3 deletions src/shared/ListRepo/ListRepo.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ describe('ListRepo', () => {
})

describe('user does not have gh app installed', () => {
it('displays github app config banner', async () => {
it('displays github app config banner if showDemoAlert is false', async () => {
setup({})
render(<ListRepo canRefetch hasGhApp={false} />, {
wrapper: wrapper({
Expand All @@ -312,9 +312,21 @@ describe('ListRepo', () => {
}),
})

const banner = await screen.findByText("Codecov's GitHub app")
return expect(banner).toBeInTheDocument()
})
it('does not display github app config banner if showDemoAlert is true', async () => {
setup({})
render(<ListRepo canRefetch hasGhApp={false} />, {
wrapper: wrapper({
url: '/gh/janedoe?source=onboarding',
path: '/:provider/:owner',
}),
})

await waitFor(() => {
const banner = screen.getByText("Codecov's GitHub app")
return expect(banner).toBeInTheDocument()
const banner = screen.queryByText("Codecov's GitHub app")
expect(banner).not.toBeInTheDocument()
})
})
})
Expand Down

0 comments on commit dfb4df6

Please sign in to comment.