Skip to content

Commit

Permalink
Update @sinonjs/referee and fix deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
mantoni committed Jul 24, 2019
1 parent 6caa89b commit 33f0163
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 45 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
},
"devDependencies": {
"@babel/core": "^7.3.3",
"@sinonjs/referee": "^3.1.1",
"@sinonjs/referee": "^3.2.0",
"babel-plugin-istanbul": "^5.1.1",
"babelify": "^10.0.0",
"browserify": "^16.2.3",
Expand Down
2 changes: 1 addition & 1 deletion test/call-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,7 @@ describe("sinonSpy.call", function() {
sinonSpy(myObj, "ouch");
});

refute.defined(myObj.ouch);
assert.isUndefined(myObj.ouch);
});

it("throws if spying on non-existent object", function() {
Expand Down
2 changes: 1 addition & 1 deletion test/fake-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ describe("fake", function() {
assert.equals(f.lastArg, false);

f();
refute.defined(f.lastArg);
assert.isUndefined(f.lastArg);
});
});

Expand Down
10 changes: 5 additions & 5 deletions test/sandbox-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1832,10 +1832,10 @@ describe("Sandbox", function() {
assert.equals(sandbox.args.length, 0);
assert.equals(object.server, this.fakeServer);
assert.clock(object.clock);
refute.defined(object.spy);
refute.defined(object.stub);
refute.defined(object.mock);
refute.defined(object.requests);
assert.isUndefined(object.spy);
assert.isUndefined(object.stub);
assert.isUndefined(object.mock);
assert.isUndefined(object.requests);

sandbox.restore();
});
Expand All @@ -1858,7 +1858,7 @@ describe("Sandbox", function() {
assert.isFunction(object.stub);
assert.isFunction(object.mock);
assert.isArray(object.requests);
refute.defined(object.sandbox);
assert.isUndefined(object.sandbox);

sandbox.restore();
});
Expand Down
28 changes: 14 additions & 14 deletions test/spy-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ describe("spy", function() {
it("does not define create method", function() {
var spy = createSpy.create();

refute.defined(spy.create);
assert.isUndefined(spy.create);
});

it("does not overwrite original create property", function() {
Expand Down Expand Up @@ -351,15 +351,15 @@ describe("spy", function() {
assert.equals(spy.withArgs(1, 2).callCount, 1);

// assert call
refute.defined(spy.getCall(0).args[0]);
assert.isUndefined(spy.getCall(0).args[0]);
assert.equals(spy.getCall(1).args[0], 1);
refute.defined(spy.getCall(1).args[1]);
assert.isUndefined(spy.getCall(1).args[1]);
assert.equals(spy.getCall(2).args[0], 1);
assert.equals(spy.getCall(2).args[1], 1);
refute.defined(spy.getCall(2).args[2]);
assert.isUndefined(spy.getCall(2).args[2]);
assert.equals(spy.getCall(3).args[0], 1);
assert.equals(spy.getCall(3).args[1], 2);
refute.defined(spy.getCall(3).args[2]);
assert.isUndefined(spy.getCall(3).args[2]);
["args", "callCount", "callId"].forEach(function(propName) {
assert.equals(spy.withArgs(1).getCall(0)[propName], spy.getCall(1)[propName]);
assert.equals(spy.withArgs(1).getCall(1)[propName], spy.getCall(2)[propName]);
Expand Down Expand Up @@ -1531,7 +1531,7 @@ describe("spy", function() {
this.spy();

assert.equals(this.spy.exceptions.length, 1);
refute.defined(this.spy.exceptions[0]);
assert.isUndefined(this.spy.exceptions[0]);
});

it("stacks up exceptions and undefined", function() {
Expand All @@ -1557,11 +1557,11 @@ describe("spy", function() {
spy();

assert.equals(spy.exceptions.length, 5);
refute.defined(spy.exceptions[0]);
assert.isUndefined(spy.exceptions[0]);
assert.equals(spy.exceptions[1], err);
refute.defined(spy.exceptions[2]);
assert.isUndefined(spy.exceptions[2]);
assert.equals(spy.exceptions[3], err);
refute.defined(spy.exceptions[4]);
assert.isUndefined(spy.exceptions[4]);
});
});

Expand Down Expand Up @@ -1665,7 +1665,7 @@ describe("spy", function() {
spy();

assert.equals(spy.returnValues.length, 1);
refute.defined(spy.returnValues[0]);
assert.isUndefined(spy.returnValues[0]);
});

it("contains return value", function() {
Expand All @@ -1688,7 +1688,7 @@ describe("spy", function() {
assert.exception(spy);

assert.equals(spy.returnValues.length, 1);
refute.defined(spy.returnValues[0]);
assert.isUndefined(spy.returnValues[0]);
});

it("contains the created object for spied constructors", function() {
Expand Down Expand Up @@ -1742,11 +1742,11 @@ describe("spy", function() {
spy();

assert.equals(spy.returnValues.length, 5);
refute.defined(spy.returnValues[0]);
assert.isUndefined(spy.returnValues[0]);
assert.equals(spy.returnValues[1], 2);
refute.defined(spy.returnValues[2]);
assert.isUndefined(spy.returnValues[2]);
assert.equals(spy.returnValues[3], 4);
refute.defined(spy.returnValues[4]);
assert.isUndefined(spy.returnValues[4]);
});
});

Expand Down
30 changes: 15 additions & 15 deletions test/stub-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ describe("stub", function() {
it("returns undefined", function() {
var stub = createStub.create();

refute.defined(stub());
assert.isUndefined(stub());
});

it("supersedes previous throws", function() {
Expand Down Expand Up @@ -794,7 +794,7 @@ describe("stub", function() {

assert.exception(stub);

refute.defined(stub.invoking);
assert.isUndefined(stub.invoking);
});
});

Expand Down Expand Up @@ -1441,7 +1441,7 @@ describe("stub", function() {
createStub(myObj, "ouch");
});

refute.defined(myObj.ouch);
assert.isUndefined(myObj.ouch);
});
});

Expand Down Expand Up @@ -2504,7 +2504,7 @@ describe("stub", function() {

assert.same(stub(5), 1);
assert.same(stub(5), 2);
refute.defined(stub(5));
assert.isUndefined(stub(5));
});

it("does not create undefined behaviour just by calling onCall", function() {
Expand All @@ -2525,13 +2525,13 @@ describe("stub", function() {

assert.same(stub(5), 1);
assert.same(stub(5), 2);
refute.defined(stub(5));
assert.isUndefined(stub(5));

stub.reset();

assert.same(stub(5), undefined);
assert.same(stub(5), undefined);
refute.defined(stub(5));
assert.isUndefined(stub(5));
});

it("throws an understandable error when trying to use withArgs on behavior", function() {
Expand Down Expand Up @@ -2777,7 +2777,7 @@ describe("stub", function() {

stub.resetBehavior();

refute.defined(stub());
assert.isUndefined(stub());
});

it("cleans behavior of fakes returned by withArgs", function() {
Expand All @@ -2786,7 +2786,7 @@ describe("stub", function() {

stub.resetBehavior();

refute.defined(stub("lolz"));
assert.isUndefined(stub("lolz"));
});

it("does not clean parents' behavior when called on a fake returned by withArgs", function() {
Expand All @@ -2804,7 +2804,7 @@ describe("stub", function() {

stub.resetBehavior();

refute.defined(stub("defined"));
assert.isUndefined(stub("defined"));
});

it("cleans 'returnsThis' behavior", function() {
Expand All @@ -2814,7 +2814,7 @@ describe("stub", function() {

instance.stub.resetBehavior();

refute.defined(instance.stub());
assert.isUndefined(instance.stub());
});

it("cleans 'resolvesThis' behavior, so the stub does not resolve nor returns anything", function() {
Expand All @@ -2824,7 +2824,7 @@ describe("stub", function() {

instance.stub.resetBehavior();

refute.defined(instance.stub());
assert.isUndefined(instance.stub());
});

describe("does not touch properties that are reset by 'reset'", function() {
Expand All @@ -2850,10 +2850,10 @@ describe("stub", function() {
assert.equals(stub.returnValues.length, 3);
assert.equals(stub.exceptions.length, 3);
assert.equals(stub.thisValues.length, 3);
assert.defined(stub.firstCall);
assert.defined(stub.secondCall);
assert.defined(stub.thirdCall);
assert.defined(stub.lastCall);
refute.isUndefined(stub.firstCall);
refute.isUndefined(stub.secondCall);
refute.isUndefined(stub.thirdCall);
refute.isUndefined(stub.lastCall);
});

it("call order state", function() {
Expand Down
8 changes: 4 additions & 4 deletions test/util/fake-timers-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ describe("fakeTimers.clock", function() {
} else {
describe("unsupported now", function() {
it("is undefined", function() {
refute.defined(this.clock.Date.now);
assert.isUndefined(this.clock.Date.now);
});
});
}
Expand All @@ -818,7 +818,7 @@ describe("fakeTimers.clock", function() {
} else {
describe("unsupported toSource", function() {
it("is undefined", function() {
refute.defined(this.clock.Date.toSource);
assert.isUndefined(this.clock.Date.toSource);
});
});
}
Expand Down Expand Up @@ -1047,7 +1047,7 @@ describe("fakeTimers.clock", function() {
this.global.Date.now = null;
this.clock = fakeTimers.useFakeTimers(0);

refute.defined(Date.now);
assert.isUndefined(Date.now);
});

it("mirrors custom Date properties", function() {
Expand Down Expand Up @@ -1192,7 +1192,7 @@ describe("fakeTimers.clock", function() {
clearTimeout: sinonStub.create()
};
this.clock = fakeTimers.useFakeTimers({ global: globalCtx });
refute.defined(this.clock.performance);
assert.isUndefined(this.clock.performance);
assert.same(this.clock._setTimeout, stub); // eslint-disable-line no-underscore-dangle
this.clock.restore();
});
Expand Down

0 comments on commit 33f0163

Please sign in to comment.