Skip to content

Commit 360b0f3

Browse files
committed
test: update test cases
Signed-off-by: Adam Setch <[email protected]>
1 parent d7e4665 commit 360b0f3

File tree

2 files changed

+49
-33
lines changed

2 files changed

+49
-33
lines changed

src/renderer/App.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import {
66
Routes,
77
useLocation,
88
} from 'react-router-dom';
9+
10+
import { BaseStyles, ThemeProvider } from '@primer/react';
11+
912
import { Loading } from './components/Loading';
1013
import { Sidebar } from './components/Sidebar';
1114
import { AppContext, AppProvider } from './context/App';
@@ -17,7 +20,6 @@ import { LoginWithPersonalAccessTokenRoute } from './routes/LoginWithPersonalAcc
1720
import { NotificationsRoute } from './routes/Notifications';
1821
import { SettingsRoute } from './routes/Settings';
1922

20-
import { BaseStyles, ThemeProvider } from '@primer/react';
2123
import './App.css';
2224

2325
function RequireAuth({ children }) {

src/renderer/routes/Accounts.test.tsx

Lines changed: 46 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import {
66
waitFor,
77
} from '@testing-library/react';
88
import { MemoryRouter } from 'react-router-dom';
9+
10+
import { BaseStyles, ThemeProvider } from '@primer/react';
11+
912
import {
1013
mockAuth,
1114
mockGitHubAppAccount,
@@ -17,7 +20,6 @@ import { AppContext } from '../context/App';
1720
import * as apiRequests from '../utils/api/request';
1821
import * as comms from '../utils/comms';
1922
import * as links from '../utils/links';
20-
2123
import { AccountsRoute } from './Accounts';
2224

2325
const mockNavigate = jest.fn();
@@ -243,17 +245,21 @@ describe('renderer/routes/Accounts.tsx', () => {
243245

244246
await act(async () => {
245247
render(
246-
<AppContext.Provider
247-
value={{
248-
auth: { accounts: [mockOAuthAccount] },
249-
settings: mockSettings,
250-
loginWithGitHubApp: mockLoginWithGitHubApp,
251-
}}
252-
>
253-
<MemoryRouter>
254-
<AccountsRoute />
255-
</MemoryRouter>
256-
</AppContext.Provider>,
248+
<ThemeProvider>
249+
<BaseStyles>
250+
<AppContext.Provider
251+
value={{
252+
auth: { accounts: [mockOAuthAccount] },
253+
settings: mockSettings,
254+
loginWithGitHubApp: mockLoginWithGitHubApp,
255+
}}
256+
>
257+
<MemoryRouter>
258+
<AccountsRoute />
259+
</MemoryRouter>
260+
</AppContext.Provider>
261+
</BaseStyles>
262+
</ThemeProvider>,
257263
);
258264
});
259265

@@ -266,16 +272,20 @@ describe('renderer/routes/Accounts.tsx', () => {
266272
it('should show login with personal access token', async () => {
267273
await act(async () => {
268274
render(
269-
<AppContext.Provider
270-
value={{
271-
auth: { accounts: [mockOAuthAccount] },
272-
settings: mockSettings,
273-
}}
274-
>
275-
<MemoryRouter>
276-
<AccountsRoute />
277-
</MemoryRouter>
278-
</AppContext.Provider>,
275+
<ThemeProvider>
276+
<BaseStyles>
277+
<AppContext.Provider
278+
value={{
279+
auth: { accounts: [mockOAuthAccount] },
280+
settings: mockSettings,
281+
}}
282+
>
283+
<MemoryRouter>
284+
<AccountsRoute />
285+
</MemoryRouter>
286+
</AppContext.Provider>
287+
</BaseStyles>
288+
</ThemeProvider>,
279289
);
280290
});
281291

@@ -294,16 +304,20 @@ describe('renderer/routes/Accounts.tsx', () => {
294304
it('should show login with oauth app', async () => {
295305
await act(async () => {
296306
render(
297-
<AppContext.Provider
298-
value={{
299-
auth: { accounts: [mockPersonalAccessTokenAccount] },
300-
settings: mockSettings,
301-
}}
302-
>
303-
<MemoryRouter>
304-
<AccountsRoute />
305-
</MemoryRouter>
306-
</AppContext.Provider>,
307+
<ThemeProvider>
308+
<BaseStyles>
309+
<AppContext.Provider
310+
value={{
311+
auth: { accounts: [mockPersonalAccessTokenAccount] },
312+
settings: mockSettings,
313+
}}
314+
>
315+
<MemoryRouter>
316+
<AccountsRoute />
317+
</MemoryRouter>
318+
</AppContext.Provider>
319+
</BaseStyles>
320+
</ThemeProvider>,
307321
);
308322
});
309323

0 commit comments

Comments
 (0)