Skip to content

Commit 354e880

Browse files
fix: Broken tests when custom GH_APP set locally (#3558)
1 parent 636cbf3 commit 354e880

File tree

6 files changed

+9
-2
lines changed

6 files changed

+9
-2
lines changed

src/layouts/Header/components/UserDropdown/UserDropdown.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ describe('UserDropdown', () => {
110110
error: null,
111111
})
112112
config.IS_SELF_HOSTED = selfHosted
113+
config.GH_APP = 'codecov'
113114
config.API_URL = ''
114115

115116
server.use(

src/pages/AccountSettings/tabs/Admin/GithubIntegrationSection/GithubIntegrationSection.test.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ describe('GithubIntegrationSection', () => {
5151
}
5252
) {
5353
config.IS_SELF_HOSTED = isSelfHosted
54+
config.GH_APP = 'codecov'
5455

5556
server.use(
5657
http.get(`/internal/gh/codecov/account-details/`, (info) => {

src/pages/DefaultOrgSelector/DefaultOrgSelector.test.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ describe('DefaultOrgSelector', () => {
189189
window.open = mockWindow
190190
const fetchNextPage = vi.fn()
191191
config.SENTRY_DSN = undefined
192+
config.GH_APP = 'codecov'
192193
const user = userEvent.setup()
193194

194195
server.use(

src/pages/DefaultOrgSelector/GitHubHelpBanner/GitHubHelpBanner.test.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { graphql, HttpResponse } from 'msw'
55
import { setupServer } from 'msw/node'
66
import { MemoryRouter, Route, Switch } from 'react-router-dom'
77

8+
import config from 'config'
9+
810
import GitHubHelpBanner from './GitHubHelpBanner'
911

1012
const queryClient = new QueryClient({
@@ -86,7 +88,7 @@ describe('GitHubHelpBanner', () => {
8688
})
8789
expect(link).toHaveAttribute(
8890
'href',
89-
'https://github.com/apps/codecov/installations/select_target'
91+
`https://github.com/apps/${config.GH_APP}/installations/select_target`
9092
)
9193
})
9294
})

src/services/navigation/useNavLinks/useStaticNavLinks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ export function useStaticNavLinks() {
194194
openNewTab: true,
195195
},
196196
codecovGithubApp: {
197-
path: () => 'https://github.com/apps/codecov',
197+
path: () => `https://github.com/apps/${config.GH_APP}`,
198198
isExternalLink: true,
199199
text: 'Codecov Github App',
200200
openNewTab: true,

src/ui/ContextSwitcher/ContextSwitcher.test.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ describe('ContextSwitcher', () => {
250250

251251
it('renders manage access restrictions', async () => {
252252
setup()
253+
config.GH_APP = 'codecov'
253254
render(
254255
<ContextSwitcher
255256
activeContext={{
@@ -715,6 +716,7 @@ describe('ContextSwitcher', () => {
715716
describe('when on self-hosted', () => {
716717
beforeEach(() => {
717718
config.IS_SELF_HOSTED = true
719+
config.GH_APP = 'codecov'
718720
setup()
719721
})
720722

0 commit comments

Comments
 (0)