Skip to content

Instantly share code, notes, and snippets.

@dancrew32
Created March 22, 2019 01:02
Show Gist options
  • Save dancrew32/35d57508c651c8c35ead128a87106fe9 to your computer and use it in GitHub Desktop.
Save dancrew32/35d57508c651c8c35ead128a87106fe9 to your computer and use it in GitHub Desktop.
react-stripe-elements mock object so you can run the damn unit tests.
export const mockWindowStripe = () => {
window.Stripe = () => ({
createSource: jest.fn(),
elements: () => ({
create: () => ({
mount: jest.fn(),
update: jest.fn(),
destroy: jest.fn(),
on: jest.fn(),
}),
}),
createToken: jest.fn(),
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment