mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
Convert methods to use sandbox
This commit is contained in:
@@ -8,7 +8,7 @@ describe("Party Controller", function() {
|
|||||||
user._id = "unique-user-id";
|
user._id = "unique-user-id";
|
||||||
User = {
|
User = {
|
||||||
user: user,
|
user: user,
|
||||||
sync: sinon.spy
|
sync: sandbox.spy
|
||||||
}
|
}
|
||||||
|
|
||||||
module(function($provide) {
|
module(function($provide) {
|
||||||
@@ -35,7 +35,7 @@ describe("Party Controller", function() {
|
|||||||
describe('questAccept', function() {
|
describe('questAccept', function() {
|
||||||
it('calls Groups.questAccept', function() {
|
it('calls Groups.questAccept', function() {
|
||||||
var party = {};
|
var party = {};
|
||||||
var groupSpy = sinon.stub(groups, "questAccept", function(){return true;});
|
var groupSpy = sandbox.stub(groups, "questAccept", function(){return true;});
|
||||||
scope.questAccept(party);
|
scope.questAccept(party);
|
||||||
groupSpy.should.have.been.calledOnce;
|
groupSpy.should.have.been.calledOnce;
|
||||||
});
|
});
|
||||||
@@ -44,7 +44,7 @@ describe("Party Controller", function() {
|
|||||||
describe('questReject', function() {
|
describe('questReject', function() {
|
||||||
it('calls Groups.questReject', function() {
|
it('calls Groups.questReject', function() {
|
||||||
var party = {};
|
var party = {};
|
||||||
var groupSpy = sinon.stub(groups, "questReject", function(){return true;});
|
var groupSpy = sandbox.stub(groups, "questReject", function(){return true;});
|
||||||
scope.questReject(party);
|
scope.questReject(party);
|
||||||
groupSpy.should.have.been.calledOnce;
|
groupSpy.should.have.been.calledOnce;
|
||||||
});
|
});
|
||||||
@@ -54,7 +54,7 @@ describe("Party Controller", function() {
|
|||||||
var party, cancelSpy, windowSpy;
|
var party, cancelSpy, windowSpy;
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
party = {};
|
party = {};
|
||||||
cancelSpy = sinon.stub(groups, "questCancel", function(){return true;});
|
cancelSpy = sandbox.stub(groups, "questCancel", function(){return true;});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function() {
|
afterEach(function() {
|
||||||
@@ -63,7 +63,7 @@ describe("Party Controller", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('calls Groups.questCancel when alert box is confirmed', function() {
|
it('calls Groups.questCancel when alert box is confirmed', function() {
|
||||||
windowSpy = sinon.stub(window, "confirm", function(){return true});
|
windowSpy = sandbox.stub(window, "confirm", function(){return true});
|
||||||
|
|
||||||
scope.questCancel(party);
|
scope.questCancel(party);
|
||||||
windowSpy.should.have.been.calledOnce;
|
windowSpy.should.have.been.calledOnce;
|
||||||
@@ -72,7 +72,7 @@ describe("Party Controller", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('does not call Groups.questCancel when alert box is confirmed', function() {
|
it('does not call Groups.questCancel when alert box is confirmed', function() {
|
||||||
windowSpy = sinon.stub(window, "confirm", function(){return false});
|
windowSpy = sandbox.stub(window, "confirm", function(){return false});
|
||||||
|
|
||||||
scope.questCancel(party);
|
scope.questCancel(party);
|
||||||
windowSpy.should.have.been.calledOnce;
|
windowSpy.should.have.been.calledOnce;
|
||||||
@@ -84,7 +84,7 @@ describe("Party Controller", function() {
|
|||||||
var party, abortSpy, windowSpy;
|
var party, abortSpy, windowSpy;
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
party = {};
|
party = {};
|
||||||
abortSpy = sinon.stub(groups, "questAbort", function(){return true;});
|
abortSpy = sandbox.stub(groups, "questAbort", function(){return true;});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function() {
|
afterEach(function() {
|
||||||
@@ -93,7 +93,7 @@ describe("Party Controller", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('calls Groups.questAbort when two alert boxes are confirmed', function() {
|
it('calls Groups.questAbort when two alert boxes are confirmed', function() {
|
||||||
windowSpy = sinon.stub(window, "confirm", function(){return true});
|
windowSpy = sandbox.stub(window, "confirm", function(){return true});
|
||||||
|
|
||||||
scope.questAbort(party);
|
scope.questAbort(party);
|
||||||
windowSpy.should.have.been.calledTwice;
|
windowSpy.should.have.been.calledTwice;
|
||||||
@@ -103,7 +103,7 @@ describe("Party Controller", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('does not call Groups.questAbort when first alert box is not confirmed', function() {
|
it('does not call Groups.questAbort when first alert box is not confirmed', function() {
|
||||||
windowSpy = sinon.stub(window, "confirm", function(){return false});
|
windowSpy = sandbox.stub(window, "confirm", function(){return false});
|
||||||
|
|
||||||
scope.questAbort(party);
|
scope.questAbort(party);
|
||||||
windowSpy.should.have.been.calledOnce;
|
windowSpy.should.have.been.calledOnce;
|
||||||
@@ -115,7 +115,7 @@ describe("Party Controller", function() {
|
|||||||
it('does not call Groups.questAbort when first alert box is confirmed but second one is not', function() {
|
it('does not call Groups.questAbort when first alert box is confirmed but second one is not', function() {
|
||||||
// Hack to confirm first window, but not second
|
// Hack to confirm first window, but not second
|
||||||
var shouldReturn = false;
|
var shouldReturn = false;
|
||||||
windowSpy = sinon.stub(window, "confirm", function(){
|
windowSpy = sandbox.stub(window, "confirm", function(){
|
||||||
shouldReturn = !shouldReturn;
|
shouldReturn = !shouldReturn;
|
||||||
return shouldReturn;
|
return shouldReturn;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user