Skip to content
This repository was archived by the owner on May 3, 2024. It is now read-only.

Commit a1dab76

Browse files
committed
fix failing test
1 parent bcc7f97 commit a1dab76

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

1-Authentication/2-sign-in-b2c/SPA/src/index.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import ReactDOM from 'react-dom/client';
33
import App from './App';
44

5-
import { BrowserRouter as Router } from 'react-router-dom';
5+
import { BrowserRouter } from 'react-router-dom';
66
import { PublicClientApplication, EventType } from '@azure/msal-browser';
77
import { msalConfig } from './authConfig';
88

@@ -17,8 +17,8 @@ export const msalInstance = new PublicClientApplication(msalConfig);
1717

1818
// Default to using the first account if no account is active on page load
1919
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]);
2222
}
2323

2424
msalInstance.addEventCallback((event) => {
@@ -35,8 +35,8 @@ msalInstance.addEventCallback((event) => {
3535
const root = ReactDOM.createRoot(document.getElementById('root'));
3636
root.render(
3737
<React.StrictMode>
38-
<Router>
38+
<BrowserRouter>
3939
<App instance={msalInstance} />
40-
</Router>
40+
</BrowserRouter>
4141
</React.StrictMode>
4242
);

1-Authentication/2-sign-in-b2c/SPA/src/sample.test.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import '@testing-library/jest-dom';
22
import { PublicClientApplication } from '@azure/msal-browser';
33
import { render, screen, waitFor } from '@testing-library/react';
4+
import { BrowserRouter } from 'react-router-dom';
45
import App from './App';
56

67
describe('Sanitize configuration object', () => {
@@ -45,7 +46,9 @@ describe('Ensure that the app starts', () => {
4546

4647
it('should render the app without crashing', async () => {
4748
render(
48-
<App instance={pca} />
49+
<BrowserRouter>
50+
<App instance={pca} />
51+
</BrowserRouter>
4952
);
5053

5154
await waitFor(() => expect(handleRedirectSpy).toHaveBeenCalledTimes(1));

0 commit comments

Comments
 (0)