Closed appsbytom closed 3 years ago
Issues solved, switched to not use the import
syntax after seeing the use of jest.doMock
it('should get ordered data', () => {
const service = require('./service');
service.getData();
expect(mockCollection).toHaveBeenNthCalledWith(1, 'data');
expect(mockOrderBy).toHaveBeenNthCalledWith(1, 'value');
});
Summary
I have my firestore services split into their own files to make mocking the responses the UI needs easier. I have been trying to use this library but can't seem to get these separated files to use the mocked firebase. If I use the db calls directly as shown in the example tests the mocks are called but that doesn't test the files making the calls.
Relevant information
service.js
service.test.js
Environment (if relevant)
N/A