mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
Updated party and group tests
This commit is contained in:
@@ -93,12 +93,9 @@ describe('Groups Controller', function() {
|
|||||||
members: [user._id]
|
members: [user._id]
|
||||||
});
|
});
|
||||||
|
|
||||||
var myGuilds = sandbox.stub(groups, "myGuilds", function() {
|
user.guilds = [guild._id];
|
||||||
return [guild];
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(scope.isMemberOfGroup(user._id, guild)).to.be.ok;
|
expect(scope.isMemberOfGroup(user._id, guild)).to.be.ok;
|
||||||
expect(myGuilds).to.be.called;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not return true if guild is not included in myGuilds call', function(){
|
it('does not return true if guild is not included in myGuilds call', function(){
|
||||||
@@ -109,12 +106,9 @@ describe('Groups Controller', function() {
|
|||||||
members: ['not-user-id']
|
members: ['not-user-id']
|
||||||
});
|
});
|
||||||
|
|
||||||
var myGuilds = sandbox.stub(groups,"myGuilds", function() {
|
user.guilds = [];
|
||||||
return [];
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(scope.isMemberOfGroup(user._id, guild)).to.not.be.ok;
|
expect(scope.isMemberOfGroup(user._id, guild)).to.not.be.ok;
|
||||||
expect(myGuilds).to.be.calledOnce;
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -78,11 +78,11 @@ describe("Party Controller", function() {
|
|||||||
initializeControllerWithStubbedState();
|
initializeControllerWithStubbedState();
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
expect(User.set).to.be.calledTwice;
|
expect(User.set).to.be.calledOnce;
|
||||||
expect(User.set).to.be.calledWith(
|
expect(User.set).to.be.calledWith(
|
||||||
{ 'achievements.partyUp': true }
|
{ 'achievements.partyUp': true }
|
||||||
);
|
);
|
||||||
expect(rootScope.openModal).to.be.calledTwice;
|
expect(rootScope.openModal).to.be.calledOnce;
|
||||||
expect(rootScope.openModal).to.be.calledWith('achievements/partyUp');
|
expect(rootScope.openModal).to.be.calledWith('achievements/partyUp');
|
||||||
done();
|
done();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
@@ -103,11 +103,11 @@ describe("Party Controller", function() {
|
|||||||
initializeControllerWithStubbedState();
|
initializeControllerWithStubbedState();
|
||||||
|
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
expect(User.set).to.be.calledTwice;
|
expect(User.set).to.be.calledOnce;
|
||||||
expect(User.set).to.be.calledWith(
|
expect(User.set).to.be.calledWith(
|
||||||
{ 'achievements.partyOn': true }
|
{ 'achievements.partyOn': true }
|
||||||
);
|
);
|
||||||
expect(rootScope.openModal).to.be.calledTwice;
|
expect(rootScope.openModal).to.be.calledOnce;
|
||||||
expect(rootScope.openModal).to.be.calledWith('achievements/partyOn');
|
expect(rootScope.openModal).to.be.calledWith('achievements/partyOn');
|
||||||
done();
|
done();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
@@ -152,9 +152,9 @@ describe("Party Controller", function() {
|
|||||||
var partyStub;
|
var partyStub;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
partyStub = sandbox.stub(groups.Group, "create", function() {
|
partyStub = sinon.stub(groups.Group, "create");
|
||||||
return party;
|
partyStub.returns(Promise.resolve(party));
|
||||||
});
|
sinon.stub(rootScope, 'hardRedirect');
|
||||||
});
|
});
|
||||||
|
|
||||||
it("creates a new party", function() {
|
it("creates a new party", function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user