Permalink
Browse files

fix(tests): add a direct unit test of signOutAccount

  • Loading branch information...
1 parent 61181e8 commit 6937fcbbd335023434aa42f2c7e39231357c24b2 @philbooth philbooth committed Jan 26, 2017
Showing with 15 additions and 3 deletions.
  1. +15 −3 app/tests/spec/models/user.js
@@ -626,9 +626,7 @@ define(function (require, exports, module) {
return p();
});
- sinon.stub(user, 'setSignedInAccount', function () {
- return p(account);
- });
+ sinon.spy(user, 'setSignedInAccount');
sinon.spy(notifier, 'triggerRemote');
@@ -657,6 +655,20 @@ define(function (require, exports, module) {
it('did not call account.retrySignUp', function () {
assert.strictEqual(account.retrySignUp.callCount, 0);
});
+
+ it('signOutAccount behaves correctly', () => {
+ sinon.stub(account, 'signOut', () => p());
+ sinon.spy(user, 'clearSignedInAccount');
+
+ return user.signOutAccount(account)
+ .then(() => {
+ assert.equal(account.signOut.callCount, 1);
+ assert.lengthOf(account.signOut.args[0], 0);
+
+ assert.equal(user.clearSignedInAccount.callCount, 1);
+ assert.lengthOf(user.clearSignedInAccount.args[0], 0);
+ });
+ });
});
describe('with an already saved account', function () {

0 comments on commit 6937fcb

Please sign in to comment.