From feec63230629483398628983f6b34e712b3aa5ad Mon Sep 17 00:00:00 2001 From: Salakar Date: Mon, 9 Apr 2018 19:32:41 +0100 Subject: [PATCH] [tests][auth] more tests - coverage now > 95% --- bridge/e2e/auth/auth.e2e.js | 58 ++++++++++++++++++++++++++++++++++++ bridge/e2e/auth/phone.e2e.js | 3 ++ 2 files changed, 61 insertions(+) create mode 100644 bridge/e2e/auth/phone.e2e.js diff --git a/bridge/e2e/auth/auth.e2e.js b/bridge/e2e/auth/auth.e2e.js index c3549ec6..ac82680f 100644 --- a/bridge/e2e/auth/auth.e2e.js +++ b/bridge/e2e/auth/auth.e2e.js @@ -3,6 +3,64 @@ describe('auth()', () => { if (firebase.auth().currentUser) await firebase.auth().signOut(); }); + describe('applyActionCode()', () => { + it('errors on invalid code', async () => { + try { + await firebase.auth().applyActionCode('fooby shooby dooby'); + } catch (e) { + e.message.should.containEql('code is invalid'); + } + }); + + xit('accepts a valid code', async () => { + // todo not sure how to generate a code yet - maybe via admin sdk? + }); + }); + + describe('checkActionCode()', () => { + it('errors on invalid code', async () => { + try { + await firebase.auth().checkActionCode('fooby shooby dooby'); + } catch (e) { + e.message.should.containEql('code is invalid'); + } + }); + + xit('accepts a valid code', async () => { + // todo not sure how to generate a code yet - maybe via admin sdk? + }); + }); + + describe('verifyPasswordResetCode()', () => { + it('errors on invalid code', async () => { + try { + await firebase.auth().verifyPasswordResetCode('fooby shooby dooby'); + } catch (e) { + e.message.should.containEql('code is invalid'); + } + }); + + xit('accepts a valid code', async () => { + // todo not sure how to generate a code yet - maybe via admin sdk? + }); + }); + + describe('confirmPasswordReset()', () => { + it('errors on invalid code', async () => { + try { + await firebase + .auth() + .confirmPasswordReset('fooby shooby dooby', 'passwordthing'); + } catch (e) { + e.message.should.containEql('code is invalid'); + } + }); + + xit('accepts a valid code', async () => { + // todo not sure how to generate a code yet - maybe via admin sdk? + }); + }); + describe('signInWithCustomToken()', () => { it('signs in with a admin sdk created custom auth token', async () => { const customUID = `custom${randomString(12, '#aA')}`; diff --git a/bridge/e2e/auth/phone.e2e.js b/bridge/e2e/auth/phone.e2e.js new file mode 100644 index 00000000..b23626e4 --- /dev/null +++ b/bridge/e2e/auth/phone.e2e.js @@ -0,0 +1,3 @@ +xdescribe('auth() => Phone', () => { + // TODO mock native events using bridge's event inspector / mocking tools (still wip) +});