jest mount does not find instance code example
Example: enzyme mount is not working for component
it('should display message retrieved with ajax request',
async (done) => {
const fakePromise = Promise.resolve(mockResponse(
200,
null,
JSON.stringify({message: message})
));
window.fetch = jest.fn().mockImplementationOnce(() => {
return fakePromise
});
expect.assertions(2);
const info = mount(<Info infoUrl = {url} />);
await Promise.all([fakePromise]);
setImmediate(() => {
try {
expect(info).toHaveState('message', message);
expect(info).toIncludeText(message);
} catch (e) {
done.fail(e);
}
done();
});
});