mirror of
https://github.com/Febbweiss/CloudBudget-AngularJS.git
synced 2026-03-04 22:35:38 +00:00
Fix: test coverage
This commit is contained in:
@@ -22,6 +22,7 @@ describe('AuthenticationService', function() {
|
|||||||
data.success.should.be.true;
|
data.success.should.be.true;
|
||||||
|
|
||||||
var user = data.user;
|
var user = data.user;
|
||||||
|
httpBackend.flush();
|
||||||
should.exist(user);
|
should.exist(user);
|
||||||
user.username.should.be.equal('test');
|
user.username.should.be.equal('test');
|
||||||
user.token.should.be.equal('tok3n');
|
user.token.should.be.equal('tok3n');
|
||||||
@@ -33,12 +34,13 @@ describe('AuthenticationService', function() {
|
|||||||
it('should fail to login and return message', function() {
|
it('should fail to login and return message', function() {
|
||||||
httpBackend
|
httpBackend
|
||||||
.when('POST', 'api/users/login')
|
.when('POST', 'api/users/login')
|
||||||
.respond(401);
|
.respond(401, {message: 'Authentication failed'});
|
||||||
|
|
||||||
AuthenticationService.login('test', 'password', function(data) {
|
AuthenticationService.login('test', 'password', function(data) {
|
||||||
data.succes.should.be.false;
|
data.succes.should.be.false;
|
||||||
|
|
||||||
var message = data.message;
|
var message = data.message;
|
||||||
|
httpBackend.flush();
|
||||||
should.exist(message);
|
should.exist(message);
|
||||||
message.should.be.equal('Authentication fail');
|
message.should.be.equal('Authentication fail');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user