Fix unit tests

This commit is contained in:
Dušan Juretić
2013-12-23 22:38:15 -03:00
parent faeeecdf04
commit 6ab10f9f3d
4 changed files with 8 additions and 7 deletions

View File

@@ -18,6 +18,7 @@ module.exports = function(config) {
'public/bower_components/marked/lib/marked.js',
'public/bower_components/js-emoji/emoji.js',
'public/bower_components/habitrpg-shared/dist/habitrpg-shared.js',
'public/bower_components/habitrpg-shared/script/userServices.js',
'public/js/*.js',
'public/js/**/*.js',
'test/mock/**/*.js',

View File

@@ -19,7 +19,7 @@ describe('Auth Controller', function() {
}));
it('should log in users with correct uname / pass', function() {
$httpBackend.expectPOST('/api/v1/user/auth/local').respond({id: 'abc', token: 'abc'});
$httpBackend.expectPOST('/api/v2/user/auth/local').respond({id: 'abc', token: 'abc'});
scope.auth();
$httpBackend.flush();
expect(user.authenticate).to.have.been.calledOnce;
@@ -27,7 +27,7 @@ describe('Auth Controller', function() {
});
it('should not log in users with incorrect uname / pass', function() {
$httpBackend.expectPOST('/api/v1/user/auth/local').respond(404, '');
$httpBackend.expectPOST('/api/v2/user/auth/local').respond(404, '');
scope.auth();
$httpBackend.flush();
expect(user.authenticate).to.not.have.been.called;

View File

@@ -12,25 +12,25 @@ describe('groupServices', function() {
}));
it('calls party endpoint', function() {
$httpBackend.expectGET('/api/v1/groups/party?').respond({});
$httpBackend.expectGET('/api/v2/groups/party?').respond({});
groups.party();
$httpBackend.flush();
});
it('calls tavern endpoint', function() {
$httpBackend.expectGET('/api/v1/groups/habitrpg?').respond({});
$httpBackend.expectGET('/api/v2/groups/habitrpg?').respond({});
groups.tavern();
$httpBackend.flush();
});
it('calls public guilds endpoint', function() {
$httpBackend.expectGET('/api/v1/groups?type=public').respond([]);
$httpBackend.expectGET('/api/v2/groups?type=public').respond([]);
groups.publicGuilds();
$httpBackend.flush();
});
it('calls my guilds endpoint', function() {
$httpBackend.expectGET('/api/v1/groups?type=guilds').respond([]);
$httpBackend.expectGET('/api/v2/groups?type=guilds').respond([]);
groups.myGuilds();
$httpBackend.flush();
});

View File

@@ -29,7 +29,7 @@ describe('memberServices', function() {
it('selects a member', function(){
var uid = 'abc';
$httpBackend.expectGET('/api/v1/members/' + uid).respond({ _id: uid });
$httpBackend.expectGET('/api/v2/members/' + uid).respond({ _id: uid });
members.selectMember(uid);
$httpBackend.flush();