In my frontend React application, I am using auth0-js
library for authentication. It exports WebAuth
class. In the code, I create an instance by calling WebAuth
Something like this:
import { WebAuth } from 'auth0-js'
const auth0Client = new WebAuth({ /* some options */ })
/*
...
using auth0Client
...
*/
I've create a file called just like the name of the library in my __mocks__
folder. Thanks to that, Jest automatically mocked this library.
// __mocks__/auth0-js.ts
const auth0Mock = jest.genMockFromModule('auth0-js')
module.exports = auth0Mock
But, in my tests I want to check whether some method on auth0Client
was invoked. How can I do this?
Aucun commentaire:
Enregistrer un commentaire