This repository was archived by the owner on May 3, 2024. It is now read-only.
File tree 2 files changed +9
-6
lines changed
1-Authentication/2-sign-in-b2c/SPA/src
2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import React from 'react';
2
2
import ReactDOM from 'react-dom/client' ;
3
3
import App from './App' ;
4
4
5
- import { BrowserRouter as Router } from 'react-router-dom' ;
5
+ import { BrowserRouter } from 'react-router-dom' ;
6
6
import { PublicClientApplication , EventType } from '@azure/msal-browser' ;
7
7
import { msalConfig } from './authConfig' ;
8
8
@@ -17,8 +17,8 @@ export const msalInstance = new PublicClientApplication(msalConfig);
17
17
18
18
// Default to using the first account if no account is active on page load
19
19
if ( ! msalInstance . getActiveAccount ( ) && msalInstance . getAllAccounts ( ) . length > 0 ) {
20
- // Account selection logic is app dependent. Adjust as needed for different use cases.
21
- msalInstance . setActiveAccount ( msalInstance . getAllAccounts ( ) [ 0 ] ) ;
20
+ // Account selection logic is app dependent. Adjust as needed for different use cases.
21
+ msalInstance . setActiveAccount ( msalInstance . getAllAccounts ( ) [ 0 ] ) ;
22
22
}
23
23
24
24
msalInstance . addEventCallback ( ( event ) => {
@@ -35,8 +35,8 @@ msalInstance.addEventCallback((event) => {
35
35
const root = ReactDOM . createRoot ( document . getElementById ( 'root' ) ) ;
36
36
root . render (
37
37
< React . StrictMode >
38
- < Router >
38
+ < BrowserRouter >
39
39
< App instance = { msalInstance } />
40
- </ Router >
40
+ </ BrowserRouter >
41
41
</ React . StrictMode >
42
42
) ;
Original file line number Diff line number Diff line change 1
1
import '@testing-library/jest-dom' ;
2
2
import { PublicClientApplication } from '@azure/msal-browser' ;
3
3
import { render , screen , waitFor } from '@testing-library/react' ;
4
+ import { BrowserRouter } from 'react-router-dom' ;
4
5
import App from './App' ;
5
6
6
7
describe ( 'Sanitize configuration object' , ( ) => {
@@ -45,7 +46,9 @@ describe('Ensure that the app starts', () => {
45
46
46
47
it ( 'should render the app without crashing' , async ( ) => {
47
48
render (
48
- < App instance = { pca } />
49
+ < BrowserRouter >
50
+ < App instance = { pca } />
51
+ </ BrowserRouter >
49
52
) ;
50
53
51
54
await waitFor ( ( ) => expect ( handleRedirectSpy ) . toHaveBeenCalledTimes ( 1 ) ) ;
You can’t perform that action at this time.
0 commit comments