From ce9d7a8a891176824389cf91e328c3b4a0c42b0d Mon Sep 17 00:00:00 2001 From: Brendan Mulholland Date: Tue, 24 Oct 2023 02:32:49 +0200 Subject: [PATCH] chore(deps): Remove history dependency (#648) * fix(deps): update dependency axios to v1 * Use new adapter setting See https://github.com/axios/axios/pull/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 --- package.json | 1 - pnpm-lock.yaml | 30 ----------------------------- src/components/Sidebar.test.tsx | 7 ++----- src/routes/Login.test.tsx | 16 ++++++--------- src/routes/LoginEnterprise.test.tsx | 16 ++++++--------- src/routes/LoginWithToken.test.tsx | 19 ++++++++---------- src/routes/Settings.test.tsx | 15 ++++++--------- 7 files changed, 28 insertions(+), 76 deletions(-) diff --git a/package.json b/package.json index 8c62bb43e..e486690d0 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,6 @@ "date-fns": "2.30.0", "electron-updater": "6.1.4", "final-form": "4.20.10", - "history": "4.10.1", "menubar": "9.3.0", "nprogress": "0.2.0", "react": "18.2.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ad729c3af..ccfbd7862 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23,9 +23,6 @@ dependencies: final-form: specifier: 4.20.10 version: 4.20.10 - history: - specifier: 4.10.1 - version: 4.10.1 menubar: specifier: 9.3.0 version: 9.3.0(electron@13.1.7) @@ -2968,17 +2965,6 @@ packages: dependencies: function-bind: 1.1.1 - /history@4.10.1: - resolution: {integrity: sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==} - dependencies: - '@babel/runtime': 7.21.5 - loose-envify: 1.4.0 - resolve-pathname: 3.0.0 - tiny-invariant: 1.3.1 - tiny-warning: 1.0.3 - value-equal: 1.0.1 - dev: false - /hosted-git-info@4.1.0: resolution: {integrity: sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==} engines: {node: '>=10'} @@ -4900,10 +4886,6 @@ packages: resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} engines: {node: '>=8'} - /resolve-pathname@3.0.0: - resolution: {integrity: sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng==} - dev: false - /resolve.exports@2.0.2: resolution: {integrity: sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==} engines: {node: '>=10'} @@ -5379,18 +5361,10 @@ packages: any-promise: 1.3.0 dev: true - /tiny-invariant@1.3.1: - resolution: {integrity: sha512-AD5ih2NlSssTCwsMznbvwMZpJ1cbhkGd2uueNxzv2jDlEeZdU04JQfRnggJQ8DrcVBGjAsCKwFBbDlVNtEMlzw==} - dev: false - /tiny-typed-emitter@2.1.0: resolution: {integrity: sha512-qVtvMxeXbVej0cQWKqVSSAHmKZEHAvxdF8HEUBFWts8h+xEo5m/lEiPakuyZ3BnCBjOD8i24kzNOiOLLgsSxhA==} dev: false - /tiny-warning@1.0.3: - resolution: {integrity: sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==} - dev: false - /tmp-promise@3.0.3: resolution: {integrity: sha512-RwM7MoPojPxsOBYnyd2hy0bxtIlVrihNs9pj5SUvY8Zz1sQcQG2tG1hSr8PDxfgEB8RNKDhqbIlroIarSNDNsQ==} dependencies: @@ -5625,10 +5599,6 @@ packages: convert-source-map: 1.9.0 dev: true - /value-equal@1.0.1: - resolution: {integrity: sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw==} - dev: false - /verror@1.10.0: resolution: {integrity: sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==} engines: {'0': node >=0.6.0} diff --git a/src/components/Sidebar.test.tsx b/src/components/Sidebar.test.tsx index 5372c5a20..94c5bf878 100644 --- a/src/components/Sidebar.test.tsx +++ b/src/components/Sidebar.test.tsx @@ -1,7 +1,5 @@ import { fireEvent, render, screen } from '@testing-library/react'; -import { createMemoryHistory } from 'history'; import * as React from 'react'; -import { Router } from 'react-router'; import { MemoryRouter } from 'react-router-dom'; import * as TestRenderer from 'react-test-renderer'; @@ -20,7 +18,6 @@ jest.mock('react-router-dom', () => ({ describe('components/Sidebar.tsx', () => { const fetchNotifications = jest.fn(); - const history = createMemoryHistory(); beforeEach(() => { fetchNotifications.mockReset(); @@ -81,9 +78,9 @@ describe('components/Sidebar.tsx', () => { it('go to the settings route', () => { const { getByLabelText } = render( - + - + , ); fireEvent.click(getByLabelText('Settings')); diff --git a/src/routes/Login.test.tsx b/src/routes/Login.test.tsx index fe70f27a0..77419ade4 100644 --- a/src/routes/Login.test.tsx +++ b/src/routes/Login.test.tsx @@ -1,8 +1,6 @@ import React from 'react'; import TestRenderer from 'react-test-renderer'; -import { Router } from 'react-router'; import { MemoryRouter } from 'react-router-dom'; -import { createMemoryHistory } from 'history'; import { render, fireEvent } from '@testing-library/react'; const { ipcRenderer } = require('electron'); @@ -17,8 +15,6 @@ jest.mock('react-router-dom', () => ({ })); describe('routes/Login.tsx', () => { - const history = createMemoryHistory(); - beforeEach(() => { mockNavigate.mockReset(); jest.spyOn(ipcRenderer, 'send'); @@ -37,17 +33,17 @@ describe('routes/Login.tsx', () => { it('should redirect to notifications once logged in', () => { const { rerender } = render( - + - + , ); rerender( - + - + , ); @@ -58,9 +54,9 @@ describe('routes/Login.tsx', () => { it('should navigate to login with github enterprise', () => { const { getByLabelText } = render( - + - , + , ); fireEvent.click(getByLabelText('Login with GitHub Enterprise')); diff --git a/src/routes/LoginEnterprise.test.tsx b/src/routes/LoginEnterprise.test.tsx index c85b231fd..f6c31c0f2 100644 --- a/src/routes/LoginEnterprise.test.tsx +++ b/src/routes/LoginEnterprise.test.tsx @@ -1,9 +1,7 @@ import * as React from 'react'; import * as TestRenderer from 'react-test-renderer'; import { fireEvent, render } from '@testing-library/react'; -import { Router } from 'react-router'; import { MemoryRouter } from 'react-router-dom'; -import { createMemoryHistory } from 'history'; const { ipcRenderer } = require('electron'); @@ -19,8 +17,6 @@ jest.mock('react-router-dom', () => ({ })); describe('routes/LoginEnterprise.js', () => { - const history = createMemoryHistory(); - const mockAccounts: AuthState = { enterpriseAccounts: [], user: null, @@ -47,9 +43,9 @@ describe('routes/LoginEnterprise.js', () => { it('let us go back', () => { const { getByLabelText } = render( - + - + , ); @@ -86,9 +82,9 @@ describe('routes/LoginEnterprise.js', () => { it('should receive a logged-in enterprise account', () => { const { rerender } = render( - + - + , ); @@ -101,9 +97,9 @@ describe('routes/LoginEnterprise.js', () => { }, }} > - + - + , ); diff --git a/src/routes/LoginWithToken.test.tsx b/src/routes/LoginWithToken.test.tsx index c4f5ccb12..a1e0d0eb4 100644 --- a/src/routes/LoginWithToken.test.tsx +++ b/src/routes/LoginWithToken.test.tsx @@ -1,9 +1,7 @@ import React from 'react'; import TestRenderer from 'react-test-renderer'; import { act, fireEvent, render, waitFor } from '@testing-library/react'; -import { Router } from 'react-router'; import { MemoryRouter } from 'react-router-dom'; -import { createMemoryHistory } from 'history'; import { shell } from 'electron'; import { AppContext } from '../context/App'; @@ -16,7 +14,6 @@ jest.mock('react-router-dom', () => ({ })); describe('routes/LoginWithToken.js', () => { - const history = createMemoryHistory(); const openExternalMock = jest.spyOn(shell, 'openExternal'); const mockValidateToken = jest.fn(); @@ -43,9 +40,9 @@ describe('routes/LoginWithToken.js', () => { it('let us go back', () => { const { getByLabelText } = render( - + - , + , ); fireEvent.click(getByLabelText('Go Back')); @@ -77,9 +74,9 @@ describe('routes/LoginWithToken.js', () => { it("should click on the 'personal access tokens' link and open the browser", async () => { const { getByText } = render( - + - + , ); @@ -93,9 +90,9 @@ describe('routes/LoginWithToken.js', () => { const { getByLabelText, getByTitle } = render( - + - + , ); @@ -119,9 +116,9 @@ describe('routes/LoginWithToken.js', () => { const { getByLabelText, getByTitle } = render( - + - + , ); diff --git a/src/routes/Settings.test.tsx b/src/routes/Settings.test.tsx index a5aedeac6..d8565a1fc 100644 --- a/src/routes/Settings.test.tsx +++ b/src/routes/Settings.test.tsx @@ -1,9 +1,7 @@ import React from 'react'; import TestRenderer, { act } from 'react-test-renderer'; import { render, fireEvent } from '@testing-library/react'; -import { Router } from 'react-router'; import { MemoryRouter } from 'react-router-dom'; -import { createMemoryHistory } from 'history'; const { ipcRenderer } = require('electron'); @@ -18,7 +16,6 @@ jest.mock('react-router-dom', () => ({ })); describe('routes/Settings.tsx', () => { - const history = createMemoryHistory(); const updateSetting = jest.fn(); beforeEach(() => { @@ -50,9 +47,9 @@ describe('routes/Settings.tsx', () => { - + - + , ); @@ -74,9 +71,9 @@ describe('routes/Settings.tsx', () => { await act(async () => { const { getByLabelText: getByLabelTextLocal } = render( - + - + , ); @@ -222,9 +219,9 @@ describe('routes/Settings.tsx', () => { await act(async () => { const { getByLabelText: getByLabelTextLocal } = render( - + - + , ); getByLabelText = getByLabelTextLocal;