habitica-self-host/test/spec/services/groupServicesSpec.js

43 lines
1 KiB
JavaScript
Raw Normal View History

2013-11-16 01:15:11 +00:00
'use strict';
describe('groupServices', function() {
2015-05-29 14:13:36 +00:00
var $httpBackend, $http, groups, user;
beforeEach(function() {
module(function($provide) {
$provide.value('User', {user:user});
});
2013-11-16 01:15:11 +00:00
inject(function(_$httpBackend_, Groups, User) {
2013-11-16 01:15:11 +00:00
$httpBackend = _$httpBackend_;
groups = Groups;
2015-05-29 14:13:36 +00:00
user = User;
user.sync = function(){};
});
});
2013-11-16 01:15:11 +00:00
it('calls party endpoint', function() {
$httpBackend.expectGET('/api/v2/groups/party').respond({});
2013-11-16 01:15:11 +00:00
groups.party();
$httpBackend.flush();
});
it('calls tavern endpoint', function() {
$httpBackend.expectGET('/api/v2/groups/habitrpg').respond({});
2013-11-16 01:15:11 +00:00
groups.tavern();
$httpBackend.flush();
});
it('calls public guilds endpoint', function() {
2013-12-24 01:38:15 +00:00
$httpBackend.expectGET('/api/v2/groups?type=public').respond([]);
2013-11-16 01:15:11 +00:00
groups.publicGuilds();
$httpBackend.flush();
});
it('calls my guilds endpoint', function() {
2013-12-24 01:38:15 +00:00
$httpBackend.expectGET('/api/v2/groups?type=guilds').respond([]);
2013-11-16 01:15:11 +00:00
groups.myGuilds();
$httpBackend.flush();
});
});