From afd41959b7f5b59217f68640d4b47f7ccbf15c74 Mon Sep 17 00:00:00 2001 From: jwngr Date: Tue, 7 Jun 2016 11:17:50 -0700 Subject: [PATCH] WIP: Updated () to return a promise --- src/FirebaseAuth.js | 4 +++- tests/unit/FirebaseAuth.spec.js | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/FirebaseAuth.js b/src/FirebaseAuth.js index 60ee0def..a4d84884 100644 --- a/src/FirebaseAuth.js +++ b/src/FirebaseAuth.js @@ -139,7 +139,9 @@ */ signOut: function() { if (this.getAuth() !== null) { - this._auth.signOut(); + return this._q.when(this._auth.signOut()); + } else { + return this._q.when(); } }, diff --git a/tests/unit/FirebaseAuth.spec.js b/tests/unit/FirebaseAuth.spec.js index 64f5dd23..6934e8d6 100644 --- a/tests/unit/FirebaseAuth.spec.js +++ b/tests/unit/FirebaseAuth.spec.js @@ -310,6 +310,10 @@ describe('FirebaseAuth',function(){ }); describe('$signOut()',function(){ + it('should return a promise', function() { + expect(authService.$signOut()).toBeAPromise(); + }); + it('will call signOut() on backing auth instance when user is signed in',function(){ spyOn(authService._, 'getAuth').and.callFake(function () { return {provider: 'facebook'};