2

My mock.

jest.mock("zustand", async () => {
  const originalModule = await jest.requireActual("zustand");
  const create = (createState) => {
    const store = originalModule((set) => {
      const state = createState(set);
      return {
        ...state,
        count: 5,
      };
    });
    return store;
  };
  return { __esModule: true, default: create };
});

when I run test I got TypeError: (0 , _zustand.default) is not a function. This happens in my store file when it tries to create store.

Ivan Uno
  • 31
  • 3

0 Answers0