mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-22 20:51:29 +10:00
FirebaseStub: added more unit tests related to functions
This commit is contained in:
19
__mocks__/__tests__/gatsby-plugin-firebase/functions.test.js
Normal file
19
__mocks__/__tests__/gatsby-plugin-firebase/functions.test.js
Normal file
@ -0,0 +1,19 @@
|
||||
import FirebaseStub from '../../gatsby-plugin-firebase';
|
||||
|
||||
test('reuses existing Functions instance', () => {
|
||||
const functions1 = FirebaseStub.functions();
|
||||
const functions2 = FirebaseStub.functions();
|
||||
|
||||
expect(functions1.uuid).toBeTruthy();
|
||||
expect(functions2.uuid).toBeTruthy();
|
||||
expect(functions1.uuid).toEqual(functions2.uuid);
|
||||
});
|
||||
|
||||
test('deleteUser function returns true', async () => {
|
||||
const deleteUser = FirebaseStub.functions().httpsCallable('deleteUser');
|
||||
|
||||
const result = await deleteUser();
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
expect(result.data).toEqual(true);
|
||||
});
|
||||
Reference in New Issue
Block a user