Skip to content

Commit

Permalink
updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sahat committed Aug 19, 2014
1 parent 3af8bb1 commit 9236b29
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
12 changes: 6 additions & 6 deletions test/$authSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ describe('$auth provider', function() {
expect($location.path()).toEqual('/login');
}));

it('should be able to handle signup errors', inject(function($auth, $httpBackend) {
it('should be able to handle signup errors', inject(function(Local, $httpBackend) {
var user = {
email: 'foo@bar.com',
password: '1234'
};
var rejected = false;

$httpBackend.expectPOST('/auth/signup').respond(404);
$httpBackend.expectPOST('/auth/signup').respond(400);

$auth.signup(user).then(angular.noop, function() {
Local.signup(user).catch(function() {
rejected = true;
});

Expand Down Expand Up @@ -95,9 +95,9 @@ describe('$auth provider', function() {
expect($location.path()).toEqual('/login');
}));

it('should have a isAuthenticated function', inject(function($auth) {
var isAuthed = $auth.isAuthenticated();
expect($auth.isAuthenticated).toBeDefined();
it('should have a isAuthenticated function', inject(function(Local) {
var isAuthed = Local.isAuthenticated();
expect(Local.isAuthenticated).toBeDefined();
expect(isAuthed).toBe(false);
}));
});
Expand Down
6 changes: 1 addition & 5 deletions test/localSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('Email and password flow', function() {
$httpBackend.expectPOST('/auth/login').respond(401, 'Wrong email or password');

Local.login(user).catch(function(response) {
result = response;
result = response.data;
});

$httpBackend.flush();
Expand Down Expand Up @@ -81,9 +81,5 @@ describe('Email and password flow', function() {
expect(Local.isAuthenticated).toBeDefined();
expect(angular.isFunction(Local.isAuthenticated)).toBe(true);
}));

it('should have a isAuthenticated function', inject(function(Local) {
expect(Local.isAuthenticated()).toBe(false);
}));
});

0 comments on commit 9236b29

Please sign in to comment.