Usage
- Write some Firebase Functions
- With your testing framework of choice, write a unit-test that imports your Firebase Functions.
wrap
your Firebase Functions. You can invoke the Firebase Function's handler by invoking thewrap
call.
Eg.
import {myFirebaseFunction} from "../index"; // Your Firebase Functions import firebaseFunctionsTest from "firebase-functions-test"; // Extracting `wrap` out of the lazy-loaded features const {wrap} = firebaseFunctionsTest(); // `jest-ts` example test('my unit test', () => { const wrappedFirebaseFunction = wrap(myFirebaseFunction); // Invoke the firebase function wrappedFirebaseFunction(); // Invoke the firebase function with CloudEvent overrides wrappedFirebaseFunction({data: {arbitrary: 'values'}}); });