Skip to content

Commit ce9d7a8

Browse files
Brendan Mulhollandrenovate[bot]afonsojramos
authored
chore(deps): Remove history dependency (#648)
* fix(deps): update dependency axios to v1 * Use new adapter setting See axios/axios#5277 * Fix tests * Remove unnecessary transform * chore(deps): Remove history dependency * chore: update tests to remove `history` --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Afonso Jorge Ramos <[email protected]>
1 parent 25f747d commit ce9d7a8

7 files changed

+28
-76
lines changed

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@
100100
"date-fns": "2.30.0",
101101
"electron-updater": "6.1.4",
102102
"final-form": "4.20.10",
103-
"history": "4.10.1",
104103
"menubar": "9.3.0",
105104
"nprogress": "0.2.0",
106105
"react": "18.2.0",

pnpm-lock.yaml

-30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Sidebar.test.tsx

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { fireEvent, render, screen } from '@testing-library/react';
2-
import { createMemoryHistory } from 'history';
32
import * as React from 'react';
4-
import { Router } from 'react-router';
53
import { MemoryRouter } from 'react-router-dom';
64
import * as TestRenderer from 'react-test-renderer';
75

@@ -20,7 +18,6 @@ jest.mock('react-router-dom', () => ({
2018

2119
describe('components/Sidebar.tsx', () => {
2220
const fetchNotifications = jest.fn();
23-
const history = createMemoryHistory();
2421

2522
beforeEach(() => {
2623
fetchNotifications.mockReset();
@@ -81,9 +78,9 @@ describe('components/Sidebar.tsx', () => {
8178
it('go to the settings route', () => {
8279
const { getByLabelText } = render(
8380
<AppContext.Provider value={{ isLoggedIn: true, notifications: [] }}>
84-
<Router location={history.location} navigator={history}>
81+
<MemoryRouter>
8582
<Sidebar />
86-
</Router>
83+
</MemoryRouter>
8784
</AppContext.Provider>,
8885
);
8986
fireEvent.click(getByLabelText('Settings'));

src/routes/Login.test.tsx

+6-10
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import React from 'react';
22
import TestRenderer from 'react-test-renderer';
3-
import { Router } from 'react-router';
43
import { MemoryRouter } from 'react-router-dom';
5-
import { createMemoryHistory } from 'history';
64
import { render, fireEvent } from '@testing-library/react';
75

86
const { ipcRenderer } = require('electron');
@@ -17,8 +15,6 @@ jest.mock('react-router-dom', () => ({
1715
}));
1816

1917
describe('routes/Login.tsx', () => {
20-
const history = createMemoryHistory();
21-
2218
beforeEach(() => {
2319
mockNavigate.mockReset();
2420
jest.spyOn(ipcRenderer, 'send');
@@ -37,17 +33,17 @@ describe('routes/Login.tsx', () => {
3733
it('should redirect to notifications once logged in', () => {
3834
const { rerender } = render(
3935
<AppContext.Provider value={{ isLoggedIn: false }}>
40-
<Router location={history.location} navigator={history}>
36+
<MemoryRouter>
4137
<LoginRoute />
42-
</Router>
38+
</MemoryRouter>
4339
</AppContext.Provider>,
4440
);
4541

4642
rerender(
4743
<AppContext.Provider value={{ isLoggedIn: true }}>
48-
<Router location={history.location} navigator={history}>
44+
<MemoryRouter>
4945
<LoginRoute />
50-
</Router>
46+
</MemoryRouter>
5147
</AppContext.Provider>,
5248
);
5349

@@ -58,9 +54,9 @@ describe('routes/Login.tsx', () => {
5854

5955
it('should navigate to login with github enterprise', () => {
6056
const { getByLabelText } = render(
61-
<Router location={history.location} navigator={history}>
57+
<MemoryRouter>
6258
<LoginRoute />
63-
</Router>,
59+
</MemoryRouter>,
6460
);
6561

6662
fireEvent.click(getByLabelText('Login with GitHub Enterprise'));

src/routes/LoginEnterprise.test.tsx

+6-10
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import * as React from 'react';
22
import * as TestRenderer from 'react-test-renderer';
33
import { fireEvent, render } from '@testing-library/react';
4-
import { Router } from 'react-router';
54
import { MemoryRouter } from 'react-router-dom';
6-
import { createMemoryHistory } from 'history';
75

86
const { ipcRenderer } = require('electron');
97

@@ -19,8 +17,6 @@ jest.mock('react-router-dom', () => ({
1917
}));
2018

2119
describe('routes/LoginEnterprise.js', () => {
22-
const history = createMemoryHistory();
23-
2420
const mockAccounts: AuthState = {
2521
enterpriseAccounts: [],
2622
user: null,
@@ -47,9 +43,9 @@ describe('routes/LoginEnterprise.js', () => {
4743
it('let us go back', () => {
4844
const { getByLabelText } = render(
4945
<AppContext.Provider value={{ accounts: mockAccounts }}>
50-
<Router location={history.location} navigator={history}>
46+
<MemoryRouter>
5147
<LoginEnterpriseRoute />
52-
</Router>
48+
</MemoryRouter>
5349
</AppContext.Provider>,
5450
);
5551

@@ -86,9 +82,9 @@ describe('routes/LoginEnterprise.js', () => {
8682
it('should receive a logged-in enterprise account', () => {
8783
const { rerender } = render(
8884
<AppContext.Provider value={{ accounts: mockAccounts }}>
89-
<Router location={history.location} navigator={history}>
85+
<MemoryRouter>
9086
<LoginEnterpriseRoute />
91-
</Router>
87+
</MemoryRouter>
9288
</AppContext.Provider>,
9389
);
9490

@@ -101,9 +97,9 @@ describe('routes/LoginEnterprise.js', () => {
10197
},
10298
}}
10399
>
104-
<Router location={history.location} navigator={history}>
100+
<MemoryRouter>
105101
<LoginEnterpriseRoute />
106-
</Router>
102+
</MemoryRouter>
107103
</AppContext.Provider>,
108104
);
109105

src/routes/LoginWithToken.test.tsx

+8-11
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import React from 'react';
22
import TestRenderer from 'react-test-renderer';
33
import { act, fireEvent, render, waitFor } from '@testing-library/react';
4-
import { Router } from 'react-router';
54
import { MemoryRouter } from 'react-router-dom';
6-
import { createMemoryHistory } from 'history';
75
import { shell } from 'electron';
86

97
import { AppContext } from '../context/App';
@@ -16,7 +14,6 @@ jest.mock('react-router-dom', () => ({
1614
}));
1715

1816
describe('routes/LoginWithToken.js', () => {
19-
const history = createMemoryHistory();
2017
const openExternalMock = jest.spyOn(shell, 'openExternal');
2118

2219
const mockValidateToken = jest.fn();
@@ -43,9 +40,9 @@ describe('routes/LoginWithToken.js', () => {
4340

4441
it('let us go back', () => {
4542
const { getByLabelText } = render(
46-
<Router location={history.location} navigator={history}>
43+
<MemoryRouter>
4744
<LoginWithToken />
48-
</Router>,
45+
</MemoryRouter>,
4946
);
5047

5148
fireEvent.click(getByLabelText('Go Back'));
@@ -77,9 +74,9 @@ describe('routes/LoginWithToken.js', () => {
7774
it("should click on the 'personal access tokens' link and open the browser", async () => {
7875
const { getByText } = render(
7976
<AppContext.Provider value={{ validateToken: mockValidateToken }}>
80-
<Router location={history.location} navigator={history}>
77+
<MemoryRouter>
8178
<LoginWithToken />
82-
</Router>
79+
</MemoryRouter>
8380
</AppContext.Provider>,
8481
);
8582

@@ -93,9 +90,9 @@ describe('routes/LoginWithToken.js', () => {
9390

9491
const { getByLabelText, getByTitle } = render(
9592
<AppContext.Provider value={{ validateToken: mockValidateToken }}>
96-
<Router location={history.location} navigator={history}>
93+
<MemoryRouter>
9794
<LoginWithToken />
98-
</Router>
95+
</MemoryRouter>
9996
</AppContext.Provider>,
10097
);
10198

@@ -119,9 +116,9 @@ describe('routes/LoginWithToken.js', () => {
119116

120117
const { getByLabelText, getByTitle } = render(
121118
<AppContext.Provider value={{ validateToken: mockValidateToken }}>
122-
<Router location={history.location} navigator={history}>
119+
<MemoryRouter>
123120
<LoginWithToken />
124-
</Router>
121+
</MemoryRouter>
125122
</AppContext.Provider>,
126123
);
127124

src/routes/Settings.test.tsx

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import React from 'react';
22
import TestRenderer, { act } from 'react-test-renderer';
33
import { render, fireEvent } from '@testing-library/react';
4-
import { Router } from 'react-router';
54
import { MemoryRouter } from 'react-router-dom';
6-
import { createMemoryHistory } from 'history';
75

86
const { ipcRenderer } = require('electron');
97

@@ -18,7 +16,6 @@ jest.mock('react-router-dom', () => ({
1816
}));
1917

2018
describe('routes/Settings.tsx', () => {
21-
const history = createMemoryHistory();
2219
const updateSetting = jest.fn();
2320

2421
beforeEach(() => {
@@ -50,9 +47,9 @@ describe('routes/Settings.tsx', () => {
5047
<AppContext.Provider
5148
value={{ settings: mockSettings, logout: logoutMock }}
5249
>
53-
<Router location={history.location} navigator={history}>
50+
<MemoryRouter>
5451
<SettingsRoute />
55-
</Router>
52+
</MemoryRouter>
5653
</AppContext.Provider>,
5754
);
5855

@@ -74,9 +71,9 @@ describe('routes/Settings.tsx', () => {
7471
await act(async () => {
7572
const { getByLabelText: getByLabelTextLocal } = render(
7673
<AppContext.Provider value={{ settings: mockSettings }}>
77-
<Router location={history.location} navigator={history}>
74+
<MemoryRouter>
7875
<SettingsRoute />
79-
</Router>
76+
</MemoryRouter>
8077
</AppContext.Provider>,
8178
);
8279

@@ -222,9 +219,9 @@ describe('routes/Settings.tsx', () => {
222219
await act(async () => {
223220
const { getByLabelText: getByLabelTextLocal } = render(
224221
<AppContext.Provider value={{ settings: mockSettings }}>
225-
<Router location={history.location} navigator={history}>
222+
<MemoryRouter>
226223
<SettingsRoute />
227-
</Router>
224+
</MemoryRouter>
228225
</AppContext.Provider>,
229226
);
230227
getByLabelText = getByLabelTextLocal;

0 commit comments

Comments
 (0)