How to mock publick package util file export in Jest

Viewed 14

Im trying to mock the implementation of a function that does not exist on this library

More specifically I want to add/mock new (named)export method to this file

I tried the following:

  beforeAll(() => {
    jest.mock("appsync-template-tester/dist/util.js", () => ({
      ...jest.requireActual("appsync-template-tester/dist/util.js"),
      customMethod: jest.fn().mockImplementation(() => ""),
    }));
  });

But still the function does not appear in here
What am I not doing correctly?

0 Answers
Related