Skip to content

Instantly share code, notes, and snippets.

@felipekm
Created April 20, 2023 15:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felipekm/33a078bce72389316d67a4a08cb73afb to your computer and use it in GitHub Desktop.
Save felipekm/33a078bce72389316d67a4a08cb73afb to your computer and use it in GitHub Desktop.
Jest Mock Class
const mock = jest.mock('@services/plaid', () => {
const PlaidService = jest.requireActual('@services/plaid');
return class PlaidServiceMock extends PlaidService {
constructor() {
super();
this.somefn = jest.fn(() => {
return { token: 'test' };
});
}
};
});
module.exports = { mock };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment