Ported groups service to user new api v3 and ported dependent controllers (#7108)

* Ported groups service to user new api v3 and ported dependent controllers

* Remove  and extra remove inviation code. Fixed group service caching and update group service tests

* Fixed test logic and added party cache support

* Added promise rejections and updated http interceptor
This commit is contained in:
Keith Holliday
2016-04-25 16:11:23 -05:00
committed by Matteo Pagliazzi
parent f2d5c921ed
commit ea490c9a1f
15 changed files with 565 additions and 210 deletions

View File

@@ -2,6 +2,7 @@
describe("Party Controller", function() {
var scope, ctrl, user, User, questsService, groups, rootScope, $controller;
var party;
beforeEach(function() {
user = specHelper.newUser(),
@@ -10,7 +11,13 @@ describe("Party Controller", function() {
user: user,
sync: sandbox.spy(),
set: sandbox.spy()
}
};
party = specHelper.newGroup({
_id: "unique-party-id",
type: 'party',
members: ['leader-id'] // Ensure we wouldn't pass automatically.
});
module(function($provide) {
$provide.value('User', User);
@@ -136,6 +143,25 @@ describe("Party Controller", function() {
});
});
describe("create", function() {
var partyStub;
beforeEach(function () {
partyStub = sandbox.stub(groups.Group, "create", function() {
return party;
});
});
it("creates a new party", function() {
var group = {
type: 'party',
};
scope.create(group);
expect(partyStub).to.be.calledOnce;
//@TODO: Check user party console.log(User.user.party.id)
});
});
describe('questAccept', function() {
beforeEach(function() {
scope.group = {