'How to re-fetch MockProvider before a "fireEvent" from @testing-library/react?
I'm trying to execute a test here that basically should execute some action after clicking a button using the mocked data returned by graphQL
<MockedProvider
mocks={mocks}>
<button data-testid="my-button">Execute Actions using mocked Data</button>
</MockedProvider>
fireEvent.click(myButton);
When it fires the button, the data received from graphQL is empty. Here is my mock:
return {
request: {
query: QUERY,
variables: {
marketCodes: '',
years: '',
minDate: null,
maxDate: null,
limit: 100
}
},
result: { data },
newData: jest.fn(() => ({ data }))
};
Can anyone help me with that?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
