jeudi 4 mars 2021

Getting For security reasons, `window.crypto` is required to run `auth0-spa-js`. when running tests on OmniAuth0 components

I am trying to create a test that will allow me to validate the following and in that order: 1.) The Login component renders, 2.) The button inside the Login component gets clicked. 3.) I then render the Logout component. As you may have guessed, I am using omniAuth0 in this scenario. Here is the code I have so far for it.

describe("The Logout component", () => {
  it("should have the button text of 'Logout'", () => {
    const domain = process.env.REACT_APP_AUTH0_DOMAIN;
    const clientId = process.env.REACT_APP_AUTH0_CLIENT_ID;

    render(
      <Auth0Provider
        domain={domain}
        clientId={clientId}
        redirectUri={window.location.origin}
      >
        <Login />
      </Auth0Provider>
    );
    fireEvent.click(screen.getByText("Login"));
    render(<Logout />);
  });
});

Aucun commentaire:

Enregistrer un commentaire