Closed imikemiller closed 5 years ago
The fix for clarity:
test('ready', async (done) => {
expect.assertions(3);
const doc = new Document('artists/FooFighters');
doc.fetch();
expect(doc.isLoading).toBe(true);
await doc.ready();
expect(doc.isLoading).toBe(false);
expect(doc.data.topAlbumId).toBe('TheColourAndTheShape');
done(); // such a valuable contribution i know!!
});
OK ignore me, the error is intermittent and is probably my connection. I did some further tests by forcing a delay inside some test cases (await new Promise(resolve => setTimeout(resolve, 5000));
) and there error is thrown regardless of whether done()
is called or not (this is obvious in hindsight).
I am getting this error when running the tests. I have a fix- I just chucked a call to
done()
at the end of the offending test case - but this feels pretty arbitrary. Seems like a call todone()
should be included in each async test in case, for some reason, firestore is slow to respond and one of the tests ends up over running timeout