Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Mock default constructor
- import SomeConstructor from "some-package"
- const SomePackageMock = {
- default: jest.fn(),
- }
- jest.mock("some-package", () => SomePackageMock)
- // Import place where construcor from some-package is used
- import { testStuff } from "../Scroll/useElementSize"
- test("stuff", () => {
- SomePackageMock.default.mockImplementationOnce(function(): any {
- // here mocked implementation goes
- })
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement