Skip to content

Commit

Permalink
fix: Broken tests when custom GH_APP set locally (#3558)
Browse files Browse the repository at this point in the history
  • Loading branch information
spalmurray-codecov authored Dec 5, 2024
1 parent 636cbf3 commit 354e880
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ describe('UserDropdown', () => {
error: null,
})
config.IS_SELF_HOSTED = selfHosted
config.GH_APP = 'codecov'
config.API_URL = ''

server.use(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ describe('GithubIntegrationSection', () => {
}
) {
config.IS_SELF_HOSTED = isSelfHosted
config.GH_APP = 'codecov'

server.use(
http.get(`/internal/gh/codecov/account-details/`, (info) => {
Expand Down
1 change: 1 addition & 0 deletions src/pages/DefaultOrgSelector/DefaultOrgSelector.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ describe('DefaultOrgSelector', () => {
window.open = mockWindow
const fetchNextPage = vi.fn()
config.SENTRY_DSN = undefined
config.GH_APP = 'codecov'
const user = userEvent.setup()

server.use(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { graphql, HttpResponse } from 'msw'
import { setupServer } from 'msw/node'
import { MemoryRouter, Route, Switch } from 'react-router-dom'

import config from 'config'

import GitHubHelpBanner from './GitHubHelpBanner'

const queryClient = new QueryClient({
Expand Down Expand Up @@ -86,7 +88,7 @@ describe('GitHubHelpBanner', () => {
})
expect(link).toHaveAttribute(
'href',
'https://github.com/apps/codecov/installations/select_target'
`https://github.com/apps/${config.GH_APP}/installations/select_target`
)
})
})
Expand Down
2 changes: 1 addition & 1 deletion src/services/navigation/useNavLinks/useStaticNavLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export function useStaticNavLinks() {
openNewTab: true,
},
codecovGithubApp: {
path: () => 'https://github.com/apps/codecov',
path: () => `https://github.com/apps/${config.GH_APP}`,
isExternalLink: true,
text: 'Codecov Github App',
openNewTab: true,
Expand Down
2 changes: 2 additions & 0 deletions src/ui/ContextSwitcher/ContextSwitcher.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ describe('ContextSwitcher', () => {

it('renders manage access restrictions', async () => {
setup()
config.GH_APP = 'codecov'
render(
<ContextSwitcher
activeContext={{
Expand Down Expand Up @@ -715,6 +716,7 @@ describe('ContextSwitcher', () => {
describe('when on self-hosted', () => {
beforeEach(() => {
config.IS_SELF_HOSTED = true
config.GH_APP = 'codecov'
setup()
})

Expand Down

0 comments on commit 354e880

Please sign in to comment.