habitica/test/spec/groupServicesSpec.js

42 lines
997 B
JavaScript
Raw Normal View History

2013-11-16 01:15:11 +00:00
'use strict';
describe('groupServices', function() {
var $httpBackend, $http, groups;
beforeEach(function() {
module(function($provide) {
$provide.value('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;
});
});
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();
});
});