Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. // Mock default constructor
  2. import SomeConstructor from "some-package"
  3.  
  4. const SomePackageMock = {
  5. default: jest.fn(),
  6. }
  7. jest.mock("some-package", () => SomePackageMock)
  8.  
  9. // Import place where construcor from some-package is used
  10. import { testStuff } from "../Scroll/useElementSize"
  11.  
  12. test("stuff", () => {
  13. SomePackageMock.default.mockImplementationOnce(function(): any {
  14. // here mocked implementation goes
  15. })
  16. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement