mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
Fix AuthCtrl tests with proper asserts
This commit is contained in:
@@ -22,16 +22,16 @@ describe('Auth Controller', function() {
|
|||||||
$httpBackend.expectPOST('/api/v2/user/auth/local').respond({id: 'abc', token: 'abc'});
|
$httpBackend.expectPOST('/api/v2/user/auth/local').respond({id: 'abc', token: 'abc'});
|
||||||
scope.auth();
|
scope.auth();
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
expect(user.authenticate).to.have.been.calledOnce;
|
sinon.assert.calledOnce(user.authenticate);
|
||||||
expect($window.alert).to.not.have.been.called;
|
sinon.assert.notCalled($window.alert);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not log in users with incorrect uname / pass', function() {
|
it('should not log in users with incorrect uname / pass', function() {
|
||||||
$httpBackend.expectPOST('/api/v2/user/auth/local').respond(404, '');
|
$httpBackend.expectPOST('/api/v2/user/auth/local').respond(404, '');
|
||||||
scope.auth();
|
scope.auth();
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
expect(user.authenticate).to.not.have.been.called;
|
sinon.assert.notCalled(user.authenticate);
|
||||||
expect($window.alert).to.have.been.calledOnce;
|
sinon.assert.calledOnce($window.alert);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user