Hi.
It is necessary to configure testing in the react application using “@auth0/auth0-react”.
When running “run test”, it says that:
console.error
Error: Uncaught [Error: For security reasons, `window.crypto` is required to run `auth0-spa-js`.]
I’ve seen this post but I don’t understand how to apply it correctly - On Netlify: `window.crypto` is required to run `auth0-spa-js` · Issue #522 · auth0/auth0-spa-js · GitHub
“@auth0/auth0-react”: “^1.7.0”,
“react”: “^17.0.2”,
App.js:
function App() {
return (
<BrowserRouter history={browserHistory}>
<Auth0ProviderWithHistory>
<ApolloProvider client={client}>
<Suspense fallback={<Loader />}>
<ReactNotification />
<ErrorBoundary>
<Routes />
</ErrorBoundary>
Learn React
</Suspense>
</ApolloProvider>
</Auth0ProviderWithHistory>
</BrowserRouter>
)
}
export default App
test:
test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});