diff --git a/src/shared/ListRepo/ListRepo.jsx b/src/shared/ListRepo/ListRepo.jsx index 0684ea7cad..818f0c7fad 100644 --- a/src/shared/ListRepo/ListRepo.jsx +++ b/src/shared/ListRepo/ListRepo.jsx @@ -60,7 +60,8 @@ function ListRepo({ canRefetch, hasGhApp }) { return ( <> - {!hasGhApp && } + {/* we only want one of these two banners to show at a time */} + {!hasGhApp && !showDemoAlert && } { }) 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(, { wrapper: wrapper({ @@ -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(, { + 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() }) }) })