Skip to content

Commit

Permalink
refactor: replace require with import
Browse files Browse the repository at this point in the history
  • Loading branch information
setchy committed May 26, 2024
1 parent 739b5cd commit 359f5c4
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/components/Repository.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { fireEvent, render, screen } from '@testing-library/react';
import { shell } from 'electron';
import { mockedGitHubNotifications } from '../__mocks__/mockedData';
import { AppContext } from '../context/App';
import { RepositoryNotifications } from './Repository';
const { shell } = require('electron');

jest.mock('./NotificationRow', () => ({
NotificationRow: () => <div>NotificationRow</div>,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Sidebar.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { fireEvent, render, screen } from '@testing-library/react';
import { ipcRenderer, shell } from 'electron';
import { MemoryRouter } from 'react-router-dom';
const { shell, ipcRenderer } = require('electron');
import { mockSettings } from '../__mocks__/mock-state';
import { mockedAccountNotifications } from '../__mocks__/mockedData';
import { AppContext } from '../context/App';
Expand Down
2 changes: 1 addition & 1 deletion src/routes/Login.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { fireEvent, render, screen } from '@testing-library/react';
import { ipcRenderer } from 'electron';
import { MemoryRouter } from 'react-router-dom';
const { ipcRenderer } = require('electron');
import { AppContext } from '../context/App';
import { LoginRoute } from './Login';

Expand Down
2 changes: 1 addition & 1 deletion src/routes/Login.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { ipcRenderer } = require('electron');
import { KeyIcon, PersonIcon } from '@primer/octicons-react';
import { ipcRenderer } from 'electron';
import { type FC, useContext, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import { Logo } from '../components/Logo';
Expand Down
4 changes: 2 additions & 2 deletions src/routes/LoginWithOAuthApp.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { fireEvent, render, screen } from '@testing-library/react';
import { MemoryRouter } from 'react-router-dom';
const { ipcRenderer } = require('electron');
import { ipcRenderer } from 'electron';
import { shell } from 'electron';
import { MemoryRouter } from 'react-router-dom';
import { mockedEnterpriseAccounts } from '../__mocks__/mockedData';
import { AppContext } from '../context/App';
import type { AuthState } from '../types';
Expand Down
4 changes: 2 additions & 2 deletions src/routes/LoginWithOAuthApp.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const ipcRenderer = require('electron').ipcRenderer;
import {
ArrowLeftIcon,
BookIcon,
PersonIcon,
SignInIcon,
} from '@primer/octicons-react';
import ipcRenderer from 'electron';
import { type FC, useCallback, useContext, useEffect } from 'react';
import { Form, type FormRenderProps } from 'react-final-form';
import { useNavigate } from 'react-router-dom';
Expand Down Expand Up @@ -65,7 +65,7 @@ export const LoginWithOAuthApp: FC = () => {

useEffect(() => {
if (enterpriseAccounts.length) {
ipcRenderer.send('reopen-window');
ipcRenderer.ipcRenderer.send('reopen-window');
navigate(-1);
}
}, [enterpriseAccounts]);
Expand Down
3 changes: 1 addition & 2 deletions src/routes/Settings.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { act, fireEvent, render, screen } from '@testing-library/react';
import { ipcRenderer, shell } from 'electron';
import { MemoryRouter } from 'react-router-dom';
const { ipcRenderer } = require('electron');
import { shell } from 'electron';
import { mockAccounts, mockSettings } from '../__mocks__/mock-state';
import { AppContext } from '../context/App';
import { SettingsRoute } from './Settings';
Expand Down

0 comments on commit 359f5c4

Please sign in to comment.