I'm trying to test my login controller, which should send users' login/password to the service and say if it exists in the service. Here is my code:
describe('LoginController', function() {
beforeEach(module('task6'));
var $controller, LoginService;
beforeEach(inject(function(_$controller_, _LoginService_) {
$controller = _$controller_;
LoginService = _LoginService_;
}));
describe('LoginController.submitLogin', function() {
it('tests if such user exists', function() {
var $scope = {};
var controller = $controller('LoginController',
{$scope: $scope});
controller.loginField = 'John';
controller.password = 'Smith';
LoginService.signIn(controller.loginField,
controller.password)
.then(function(logged) {
expect(true).toBe(false);
});
});
});
});
But it seems like tests in ".then" function never executed. It passes all the tests even with these conditions.