(key, data, validatorParam)
| 45 | return type; |
| 46 | }; |
| 47 | const checkKey = (key, data, validatorParam) => { |
| 48 | const parameter = data[key]; |
| 49 | if (!parameter) { |
| 50 | throw `${key} is not a supported parameter for Cloud Function validations.`; |
| 51 | } |
| 52 | const types = parameter.map(type => getType(type)); |
| 53 | const type = getType(validatorParam); |
| 54 | if (!types.includes(type) && !types.includes('Any')) { |
| 55 | throw `Invalid type for Cloud Function validation key ${key}. Expected ${types.join( |
| 56 | '|' |
| 57 | )}, actual ${type}`; |
| 58 | } |
| 59 | }; |
| 60 | for (const key in validator) { |
| 61 | checkKey(key, allowedKeys, validator[key]); |
| 62 | if (key === 'fields' || key === 'requireUserKeys') { |
no test coverage detected