Skip to content
Discussion options

You must be logged in to vote

In case anybody else finds the same problem, here is my solution.

jest.mock("swr");
useSWRInfinite.mockReturnValue({ "data": [{ data: [] }], "error": null });

  it.only('should show the BlankSate component', async () => {
    useSWRInfinite.mockReturnValue({ "data": [{ data: [] }], "error": null }); //set mock value per test

    wrapper = mount(
      <RouterContext.Provider value={router}>
        <Servers title="Servers" />
      </RouterContext.Provider>);
      expect(wrapper.find(BlankState)).toHaveLength(1); //it breaks here with the act message
  });

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@ilgianfra
Comment options

@nathanmrtns
Comment options

@ilgianfra
Comment options

@nathanmrtns
Comment options

@ilgianfra
Comment options

Answer selected by nathanmrtns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants