Closed RyanMarten closed 4 years ago
Can also look at this other Github actions Cache from the market place: https://github.com/marketplace/actions/cache works on Yarn too
From the Github Actions workflow:
Ran all test suites.
Jest did not exit one second after the test run has completed.
This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.
##[error]The operation was canceled.
I guess this means I should take the asynchronous calls out of Map.js and Firestore.js and mock them instead
https://jestjs.io/docs/en/mock-functions.html#mocking-modules
This is confusing and difficult, but I think this is the resource I am going to focus on.
It is just not working: let's try google again: https://medium.com/@jamomani/mocking-firebase-cloud-functions-in-react-js-with-jest-d5596d25da2
Ok let's try specifically how people Jest Mock Firestore, not only just firebase: https://stackoverflow.com/questions/52043886/how-do-you-mock-firebase-firestore-methods-using-jest https://medium.com/stories-from-upstatement/jest-mocks-roasting-on-an-open-firestore-36fa55b76953 https://stackoverflow.com/questions/52043886/how-do-you-mock-firebase-firestore-methods-using-jest
Alright this is pretty complex so I am going to use this library: https://medium.com/stories-from-upstatement/jest-mocks-roasting-on-an-open-firestore-36fa55b76953
https://github.com/Upstatement/firestore-jest-mock
npm install --save-dev firestore-jest-mock
^^ THAT WORKS SO WELL :))))))
Using links in #165 about mocking