Skip to content

Commit 8461fb0

Browse files
committed
refactor: login routes
Signed-off-by: Adam Setch <[email protected]>
1 parent 888bac5 commit 8461fb0

File tree

5 files changed

+26
-23
lines changed

5 files changed

+26
-23
lines changed

src/app.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import { AppContext, AppProvider } from './context/App';
1212
import { AccountsRoute } from './routes/Accounts';
1313
import { FiltersRoute } from './routes/Filters';
1414
import { LoginRoute } from './routes/Login';
15-
import { LoginWithOAuthApp } from './routes/LoginWithOAuthApp';
16-
import { LoginWithPersonalAccessToken } from './routes/LoginWithPersonalAccessToken';
15+
import { LoginWithOAuthAppRoute } from './routes/LoginWithOAuthApp';
16+
import { LoginWithPersonalAccessTokenRoute } from './routes/LoginWithPersonalAccessToken';
1717
import { NotificationsRoute } from './routes/Notifications';
1818
import { SettingsRoute } from './routes/Settings';
1919

@@ -71,9 +71,12 @@ export const App = () => {
7171
<Route path="/login" element={<LoginRoute />} />
7272
<Route
7373
path="/login-personal-access-token"
74-
element={<LoginWithPersonalAccessToken />}
74+
element={<LoginWithPersonalAccessTokenRoute />}
75+
/>
76+
<Route
77+
path="/login-oauth-app"
78+
element={<LoginWithOAuthAppRoute />}
7579
/>
76-
<Route path="/login-oauth-app" element={<LoginWithOAuthApp />} />
7780
</Routes>
7881
</div>
7982
</Router>

src/routes/LoginWithOAuthApp.test.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { MemoryRouter } from 'react-router-dom';
33
import { AppContext } from '../context/App';
44
import type { AuthState, ClientID, ClientSecret, Hostname } from '../types';
55
import * as comms from '../utils/comms';
6-
import { LoginWithOAuthApp, validate } from './LoginWithOAuthApp';
6+
import { LoginWithOAuthAppRoute, validate } from './LoginWithOAuthApp';
77

88
const mockNavigate = jest.fn();
99
jest.mock('react-router-dom', () => ({
@@ -30,7 +30,7 @@ describe('routes/LoginWithOAuthApp.tsx', () => {
3030
const tree = render(
3131
<AppContext.Provider value={{ auth: mockAuth }}>
3232
<MemoryRouter>
33-
<LoginWithOAuthApp />
33+
<LoginWithOAuthAppRoute />
3434
</MemoryRouter>
3535
</AppContext.Provider>,
3636
);
@@ -42,7 +42,7 @@ describe('routes/LoginWithOAuthApp.tsx', () => {
4242
render(
4343
<AppContext.Provider value={{ auth: mockAuth }}>
4444
<MemoryRouter>
45-
<LoginWithOAuthApp />
45+
<LoginWithOAuthAppRoute />
4646
</MemoryRouter>
4747
</AppContext.Provider>,
4848
);
@@ -81,7 +81,7 @@ describe('routes/LoginWithOAuthApp.tsx', () => {
8181
render(
8282
<AppContext.Provider value={{ auth: mockAuth }}>
8383
<MemoryRouter>
84-
<LoginWithOAuthApp />
84+
<LoginWithOAuthAppRoute />
8585
</MemoryRouter>
8686
</AppContext.Provider>,
8787
);
@@ -95,7 +95,7 @@ describe('routes/LoginWithOAuthApp.tsx', () => {
9595
render(
9696
<AppContext.Provider value={{ auth: mockAuth }}>
9797
<MemoryRouter>
98-
<LoginWithOAuthApp />
98+
<LoginWithOAuthAppRoute />
9999
</MemoryRouter>
100100
</AppContext.Provider>,
101101
);
@@ -120,7 +120,7 @@ describe('routes/LoginWithOAuthApp.tsx', () => {
120120
}}
121121
>
122122
<MemoryRouter>
123-
<LoginWithOAuthApp />
123+
<LoginWithOAuthAppRoute />
124124
</MemoryRouter>
125125
</AppContext.Provider>,
126126
);
@@ -147,7 +147,7 @@ describe('routes/LoginWithOAuthApp.tsx', () => {
147147
render(
148148
<AppContext.Provider value={{ auth: mockAuth }}>
149149
<MemoryRouter>
150-
<LoginWithOAuthApp />
150+
<LoginWithOAuthAppRoute />
151151
</MemoryRouter>
152152
</AppContext.Provider>,
153153
);
@@ -173,7 +173,7 @@ describe('routes/LoginWithOAuthApp.tsx', () => {
173173
render(
174174
<AppContext.Provider value={{ auth: mockAuth }}>
175175
<MemoryRouter>
176-
<LoginWithOAuthApp />
176+
<LoginWithOAuthAppRoute />
177177
</MemoryRouter>
178178
</AppContext.Provider>,
179179
);

src/routes/LoginWithOAuthApp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export const validate = (values: IValues): IFormErrors => {
5959
return errors;
6060
};
6161

62-
export const LoginWithOAuthApp: FC = () => {
62+
export const LoginWithOAuthAppRoute: FC = () => {
6363
const navigate = useNavigate();
6464

6565
const { loginWithOAuthApp } = useContext(AppContext);

src/routes/LoginWithPersonalAccessToken.test.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { MemoryRouter } from 'react-router-dom';
99
import { AppContext } from '../context/App';
1010
import * as comms from '../utils/comms';
1111
import {
12-
LoginWithPersonalAccessToken,
12+
LoginWithPersonalAccessTokenRoute,
1313
validate,
1414
} from './LoginWithPersonalAccessToken';
1515

@@ -32,7 +32,7 @@ describe('routes/LoginWithPersonalAccessToken.tsx', () => {
3232
it('renders correctly', () => {
3333
const tree = render(
3434
<MemoryRouter>
35-
<LoginWithPersonalAccessToken />
35+
<LoginWithPersonalAccessTokenRoute />
3636
</MemoryRouter>,
3737
);
3838

@@ -42,7 +42,7 @@ describe('routes/LoginWithPersonalAccessToken.tsx', () => {
4242
it('let us go back', () => {
4343
render(
4444
<MemoryRouter>
45-
<LoginWithPersonalAccessToken />
45+
<LoginWithPersonalAccessTokenRoute />
4646
</MemoryRouter>,
4747
);
4848

@@ -80,7 +80,7 @@ describe('routes/LoginWithPersonalAccessToken.tsx', () => {
8080
}}
8181
>
8282
<MemoryRouter>
83-
<LoginWithPersonalAccessToken />
83+
<LoginWithPersonalAccessTokenRoute />
8484
</MemoryRouter>
8585
</AppContext.Provider>,
8686
);
@@ -102,7 +102,7 @@ describe('routes/LoginWithPersonalAccessToken.tsx', () => {
102102
}}
103103
>
104104
<MemoryRouter>
105-
<LoginWithPersonalAccessToken />
105+
<LoginWithPersonalAccessTokenRoute />
106106
</MemoryRouter>
107107
</AppContext.Provider>,
108108
);
@@ -123,7 +123,7 @@ describe('routes/LoginWithPersonalAccessToken.tsx', () => {
123123
}}
124124
>
125125
<MemoryRouter>
126-
<LoginWithPersonalAccessToken />
126+
<LoginWithPersonalAccessTokenRoute />
127127
</MemoryRouter>
128128
</AppContext.Provider>,
129129
);
@@ -155,7 +155,7 @@ describe('routes/LoginWithPersonalAccessToken.tsx', () => {
155155
}}
156156
>
157157
<MemoryRouter>
158-
<LoginWithPersonalAccessToken />
158+
<LoginWithPersonalAccessTokenRoute />
159159
</MemoryRouter>
160160
</AppContext.Provider>,
161161
);
@@ -181,7 +181,7 @@ describe('routes/LoginWithPersonalAccessToken.tsx', () => {
181181
it('should render the form with errors', () => {
182182
render(
183183
<MemoryRouter>
184-
<LoginWithPersonalAccessToken />
184+
<LoginWithPersonalAccessTokenRoute />
185185
</MemoryRouter>,
186186
);
187187

@@ -206,7 +206,7 @@ describe('routes/LoginWithPersonalAccessToken.tsx', () => {
206206
}}
207207
>
208208
<MemoryRouter>
209-
<LoginWithPersonalAccessToken />
209+
<LoginWithPersonalAccessTokenRoute />
210210
</MemoryRouter>
211211
</AppContext.Provider>,
212212
);

src/routes/LoginWithPersonalAccessToken.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const validate = (values: IValues): IFormErrors => {
4444
return errors;
4545
};
4646

47-
export const LoginWithPersonalAccessToken: FC = () => {
47+
export const LoginWithPersonalAccessTokenRoute: FC = () => {
4848
const { loginWithPersonalAccessToken } = useContext(AppContext);
4949
const navigate = useNavigate();
5050
const [isValidToken, setIsValidToken] = useState<boolean>(true);

0 commit comments

Comments
 (0)