When running the function, the wrapper tries to extract the EventContextparams from the triggered data based on the wildcard path.
E.g. A wildcard path of users/{userId} run against with users/FOO would result in params: { userId: 'FOO' }.
Provided params to the wrapped function are preferred over the extracted ones - I've only done this to prevent breaking usage for anyone whose not matching the values in the path up to the provided params.
Also added tests (and updated the auth and authType tests as they were just being run with junk data).
Description
When running the function, the wrapper tries to extract the
EventContext
params
from the triggered data based on the wildcard path.E.g. A wildcard path of
users/{userId}
run against withusers/FOO
would result inparams: { userId: 'FOO' }
.Provided
params
to the wrapped function are preferred over the extracted ones - I've only done this to prevent breaking usage for anyone whose not matching the values in the path up to the providedparams
.Also added tests (and updated the
auth and authType
tests as they were just being run with junk data).Code sample
See the tests:
Firebase RTDB - https://github.com/bookcreator/firebase-functions-test/blob/params/spec/main.spec.ts#L150-L165 Firestore - https://github.com/bookcreator/firebase-functions-test/blob/params/spec/main.spec.ts#L167-L185