tests(functions): jest migration (#3587)

* Updated functions jest tests

* Additonal tests added for httpcallable

* tests(functions): updated try catch tests

* Update .eslintrc.js

Co-authored-by: Mike Diarmid <mike.diarmid@gmail.com>
This commit is contained in:
Darren Ackers
2020-05-05 23:28:36 +01:00
committed by GitHub
parent f0fdbff719
commit 0e72e62c8a
2 changed files with 7 additions and 10 deletions

View File

@@ -38,7 +38,8 @@ module.exports = {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/ban-ts-ignore': 'warn',
// off for validation tests
'@typescript-eslint/ban-ts-ignore': 'off',
},
globals: {
__DEV__: true,

View File

@@ -25,16 +25,12 @@ describe('Cloud Functions', () => {
describe('httpcallable()', () => {
it('throws an error with an incorrect timeout', () => {
try {
const app = firebase.app();
const app = firebase.app();
// @ts-ignore
app.functions().httpsCallable('example', { timeout: 'test' });
return Promise.reject(new Error('Did not throw'));
} catch (e) {
expect(e.message).toEqual('HttpsCallableOptions.timeout expected a Number in milliseconds');
return Promise.resolve();
}
// @ts-ignore
expect(() => app.functions().httpsCallable('example', { timeout: 'test' })).toThrow(
'HttpsCallableOptions.timeout expected a Number in milliseconds',
);
});
});
});