mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
Fix unit tests
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user