Skip to content

Commit

Permalink
tests(functions): jest migration (invertase#3587)
Browse files Browse the repository at this point in the history
* Updated functions jest tests

* Additonal tests added for httpcallable

* tests(functions): updated try catch tests

* Update .eslintrc.js

Co-authored-by: Mike Diarmid <[email protected]>
  • Loading branch information
dackers86 and Salakar authored May 5, 2020
1 parent f0fdbff commit 0e72e62
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
14 changes: 5 additions & 9 deletions packages/functions/__tests__/functions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
);
});
});
});

0 comments on commit 0e72e62

Please sign in to comment.