From ca6dca5fd08583a19704118875f24a15b028c36c Mon Sep 17 00:00:00 2001 From: Keith Holliday Date: Thu, 12 May 2016 12:55:34 -0500 Subject: [PATCH] Fixed test broken by part sync change (#7195) --- test/spec/controllers/headerCtrlSpec.js | 7 +++---- test/spec/controllers/partyCtrlSpec.js | 6 +++--- test/spec/services/groupServicesSpec.js | 10 ++++++---- test/spec/services/questServicesSpec.js | 1 + 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/test/spec/controllers/headerCtrlSpec.js b/test/spec/controllers/headerCtrlSpec.js index ab37d11205..b32c5ccbd5 100644 --- a/test/spec/controllers/headerCtrlSpec.js +++ b/test/spec/controllers/headerCtrlSpec.js @@ -5,13 +5,12 @@ describe('Header Controller', function() { beforeEach(function() { module(function($provide) { - $provide.value('User', {}); + user = specHelper.newUser(); + user._id = "unique-user-id" + $provide.value('User', {user: user}); }); inject(function(_$rootScope_, _$controller_, _$location_){ - user = specHelper.newUser(); - user._id = "unique-user-id" - scope = _$rootScope_.$new(); $rootScope = _$rootScope_; diff --git a/test/spec/controllers/partyCtrlSpec.js b/test/spec/controllers/partyCtrlSpec.js index f9571c8ef1..b27cad2e47 100644 --- a/test/spec/controllers/partyCtrlSpec.js +++ b/test/spec/controllers/partyCtrlSpec.js @@ -61,7 +61,7 @@ describe("Party Controller", function() { context('party has 1 member', function() { it('awards no new achievements', function() { - groupResponse = {data: {data: {_id: "test", type: "party", memberCount: 1}}}; + groupResponse = {_id: "test", type: "party", memberCount: 1}; initializeControllerWithStubbedState(); @@ -73,7 +73,7 @@ describe("Party Controller", function() { context('party has 2 members', function() { context('user does not have "Party Up" achievement', function() { it('awards "Party Up" achievement', function(done) { - groupResponse = {data: {data: {_id: "test", type: "party", memberCount: 2}}}; + groupResponse = {_id: "test", type: "party", memberCount: 2}; initializeControllerWithStubbedState(); @@ -93,7 +93,7 @@ describe("Party Controller", function() { context('party has 4 members', function() { beforeEach(function() { - groupResponse = {data: {data: {_id: "test", type: "party", memberCount: 4}}}; + groupResponse = {_id: "test", type: "party", memberCount: 4}; }); context('user has "Party Up" but not "Party On" achievement', function() { diff --git a/test/spec/services/groupServicesSpec.js b/test/spec/services/groupServicesSpec.js index 065af0b233..138fb6152a 100644 --- a/test/spec/services/groupServicesSpec.js +++ b/test/spec/services/groupServicesSpec.js @@ -6,14 +6,16 @@ describe('groupServices', function() { beforeEach(function() { module(function($provide) { - $provide.value('User', {user:user}); + user = specHelper.newUser(); + user._id = "unique-user-id" + user.party._id = 'unique-party-id'; + user.sync = function(){}; + $provide.value('User', {user: user}); }); inject(function(_$httpBackend_, Groups, User) { $httpBackend = _$httpBackend_; groups = Groups; - user = User; - user.sync = function(){}; }); }); @@ -152,6 +154,6 @@ describe('groupServices', function() { done(); }); - $httpBackend.flush(); + $httpBackend.flush() }); }); diff --git a/test/spec/services/questServicesSpec.js b/test/spec/services/questServicesSpec.js index bf09847e9d..fd9dbf493f 100644 --- a/test/spec/services/questServicesSpec.js +++ b/test/spec/services/questServicesSpec.js @@ -8,6 +8,7 @@ describe('Quests Service', function() { user.ops = { buyQuest: sandbox.spy() }; + user.party._id = 'unique-party-id'; user.achievements.quests = {}; quest = {lvl:20};