-
Notifications
You must be signed in to change notification settings - Fork 94
Open
Description
I have this code
async findBotletByTelephonyNumber(number: string): Promise<any> {
const botletSnapshot = await this.firebaseService.firestore
.collection('botlet')
.where(`assignedNumbers.${number}`, '==', true)
.limit(1)
.get();
... rest of my code
and in my test (with jest) I have below code
const result = await service.findBotletByTelephonyNumber('123');
expect(result).toMatchObject({
assignedNumbers: {
'123': true
}
});
expect(firebaseService.firestore.collection).toHaveBeenCalled();
expect(firebaseService.firestore.collection).toHaveBeenCalledWith('botlet');
expect(firebaseService.firestore.collection().where).toHaveBeenCalled();
expect(firebaseService.firestore.collection().where).toHaveBeenCalledWith(`assignedNumbers.123`, '==', true);
but I get below error
expect(jest.fn()).toHaveBeenCalled()
Expected mock function to have been called, but it was not called.
129 | expect(firebaseService.firestore.collection).toHaveBeenCalled();
130 | expect(firebaseService.firestore.collection).toHaveBeenCalledWith('botlet');
> 131 | expect(firebaseService.firestore.collection().where).toHaveBeenCalled();
| ^
132 | expect(firebaseService.firestore.collection().where).toHaveBeenCalledWith(`assignedNumbers.123`, '==', true);
133 | });
134 |
at Object.it (custom-settings/custom-settings.service.spec.ts:131:58)
What I am doing wrong?
Metadata
Metadata
Assignees
Labels
No labels