Closed JFGHT closed 4 years ago
As you can see here https://github.com/firebase/firebase-functions/blob/master/src/providers/https.ts, there's rawRequest: Request; missing from firebase-functions-test's CallableContextOptions.
rawRequest: Request;
CallableContextOptions
It is not possible to wrap the function with a rawRequest under the context option because _checkOptionValidity doesn't pass.
rawRequest
_checkOptionValidity
myFunctions = require('../src/index'); const wrapped = testEnv.wrap(myFunctions.bankAccountChange); const onCallObjects: [any, ContextOptions] = [ {}, { auth: { uid: '32344', token: { email: 'blab' } }, // @ts-ignore rawRequest: { headers: { origin: 'url' } }, }, ]; await expect(wrapped(...onCallObjects)).rejects.toThrow('There was an error reading the investor data.');
Throws error: Options object {"auth":{"uid":"32344","token":{"email":"blab"}},"rawRequest":{"headers":{"origin":"url"}}} has invalid key "rawRequest"
Options object {"auth":{"uid":"32344","token":{"email":"blab"}},"rawRequest":{"headers":{"origin":"url"}}} has invalid key "rawRequest"
As you can see here https://github.com/firebase/firebase-functions/blob/master/src/providers/https.ts, there's
rawRequest: Request;
missing from firebase-functions-test'sCallableContextOptions
.It is not possible to wrap the function with a
rawRequest
under the context option because_checkOptionValidity
doesn't pass.Steps to reproduce
Actual behavior
Throws error:
Options object {"auth":{"uid":"32344","token":{"email":"blab"}},"rawRequest":{"headers":{"origin":"url"}}} has invalid key "rawRequest"