Skip to content

Commit

Permalink
Update code to stricter linting
Browse files Browse the repository at this point in the history
  • Loading branch information
fatso83 committed Sep 12, 2017
1 parent 212e91d commit 32e4516
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 56 deletions.
4 changes: 2 additions & 2 deletions lib/sinon/sandbox-stub.js
Expand Up @@ -20,8 +20,8 @@ function sandboxStub(object, property) {
&& (typeof actualDescriptor === "undefined"
|| typeof actualDescriptor.value !== "function");
var stubbed = isStubbingNonFuncProperty ?
stubNonFunctionProperty.apply(null, arguments) :
sinonStub.apply(null, arguments);
stubNonFunctionProperty.apply(null, arguments) :
sinonStub.apply(null, arguments);

if (isStubbingEntireObject) {
var ownMethods = collectOwnMethods(stubbed);
Expand Down
4 changes: 2 additions & 2 deletions lib/sinon/spy.js
Expand Up @@ -245,8 +245,8 @@ var spyApi = {
}

return spyCall(this, this.thisValues[i], this.args[i],
this.returnValues[i], this.exceptions[i],
this.callIds[i], this.errorsWithCallStack[i]);
this.returnValues[i], this.exceptions[i],
this.callIds[i], this.errorsWithCallStack[i]);
},

getCalls: function () {
Expand Down
2 changes: 1 addition & 1 deletion scripts/set-release-id-in-config-yml.js
Expand Up @@ -7,6 +7,6 @@ var yaml = require("js-yaml");
var releaseId = "v" + require("../package.json").version;
var config = yaml.safeLoad(fs.readFileSync(configYmlPath, UTF8));

config.sinon.current_release = releaseId; // eslint-disable-line camelcase
config.sinon.current_release = releaseId; // eslint-disable-line camelcase

fs.writeFileSync(configYmlPath, yaml.safeDump(config), UTF8);
62 changes: 31 additions & 31 deletions test/assert-test.js
Expand Up @@ -1165,15 +1165,15 @@ describe("assert", function () {

it("assert.called exception message", function () {
assert.equals(this.message("called", this.obj.doSomething),
"expected doSomething to have been called at " +
"expected doSomething to have been called at " +
"least once but was never called");
});

it("assert.notCalled exception message one call", function () {
this.obj.doSomething();

assert.equals(this.message("notCalled", this.obj.doSomething).replace(/ at.*/g, ""),
"expected doSomething to not have been called " +
"expected doSomething to not have been called " +
"but was called once\n doSomething()");
});

Expand All @@ -1184,7 +1184,7 @@ describe("assert", function () {
this.obj.doSomething();

assert.equals(this.message("notCalled", this.obj.doSomething).replace(/ at.*/g, ""),
"expected doSomething to not have been called " +
"expected doSomething to not have been called " +
"but was called 4 times\n doSomething()\n " +
"doSomething()\n doSomething()\n doSomething()");
});
Expand All @@ -1196,7 +1196,7 @@ describe("assert", function () {
this.obj.doSomething();

assert.equals(this.message("notCalled", this.obj.doSomething).replace(/ at.*/g, ""),
"expected doSomething to not have been called " +
"expected doSomething to not have been called " +
"but was called 4 times\n doSomething()\n " +
"doSomething(3)\n doSomething(42, 1)\n doSomething()");
});
Expand All @@ -1213,7 +1213,7 @@ describe("assert", function () {
var message = this.message("callOrder", this.obj.doSomething, obj.doop, obj.foo);

assert.equals(message,
"expected doSomething, doop, foo to be called in " +
"expected doSomething, doop, foo to be called in " +
"order but were called as doop, doSomething, foo");
});

Expand All @@ -1227,7 +1227,7 @@ describe("assert", function () {
var message = this.message("callOrder", obj.doop, obj.foo);

assert.equals(message,
"expected doop, foo to be called in " +
"expected doop, foo to be called in " +
"order but were called as foo");
});

Expand All @@ -1241,15 +1241,15 @@ describe("assert", function () {
var message = this.message("callOrder", obj.doop, obj.foo);

assert.equals(message,
"expected doop, foo to be called in " +
"expected doop, foo to be called in " +
"order but were called as doop");
});

it("assert.callCount exception message", function () {
this.obj.doSomething();

assert.equals(this.message("callCount", this.obj.doSomething, 3).replace(/ at.*/g, ""),
"expected doSomething to be called thrice but was called " +
"expected doSomething to be called thrice but was called " +
"once\n doSomething()");
});

Expand All @@ -1258,21 +1258,21 @@ describe("assert", function () {
this.obj.doSomething();

assert.equals(this.message("calledOnce", this.obj.doSomething).replace(/ at.*/g, ""),
"expected doSomething to be called once but was called " +
"expected doSomething to be called once but was called " +
"twice\n doSomething()\n doSomething()");

this.obj.doSomething();

assert.equals(this.message("calledOnce", this.obj.doSomething).replace(/ at.*/g, ""),
"expected doSomething to be called once but was called " +
"expected doSomething to be called once but was called " +
"thrice\n doSomething()\n doSomething()\n doSomething()");
});

it("assert.calledTwice exception message", function () {
this.obj.doSomething();

assert.equals(this.message("calledTwice", this.obj.doSomething).replace(/ at.*/g, ""),
"expected doSomething to be called twice but was called " +
"expected doSomething to be called twice but was called " +
"once\n doSomething()");
});

Expand Down Expand Up @@ -1345,22 +1345,22 @@ describe("assert", function () {
this.obj.doSomething();

assert.equals(this.message("calledWithNew", this.obj.doSomething),
"expected doSomething to be called with new");
"expected doSomething to be called with new");
});

it("assert.alwaysCalledWithNew exception message", function () {
new this.obj.doSomething(); // eslint-disable-line no-new, new-cap
this.obj.doSomething();

assert.equals(this.message("alwaysCalledWithNew", this.obj.doSomething),
"expected doSomething to always be called with new");
"expected doSomething to always be called with new");
});

it("assert.calledWith exception message", function () {
this.obj.doSomething(4, 3, "hey");

assert.equals(this.message("calledWith", this.obj.doSomething, 1, 3, "hey").replace(/ at.*/g, ""),
"expected doSomething to be called with arguments \n" +
"expected doSomething to be called with arguments \n" +
color.red("4") + " " + color.green("1") + " \n" +
"3\n" +
"hey");
Expand All @@ -1371,7 +1371,7 @@ describe("assert", function () {
this.obj.doSomething(1, 3, "not");

assert.equals(this.message("calledWith", this.obj.doSomething, 1, 3, "hey").replace(/ at.*/g, ""),
"expected doSomething to be called with arguments " +
"expected doSomething to be called with arguments " +
"Call 1:\n" +
color.red("4") + " " + color.green("1") + " \n" +
"3\n" +
Expand Down Expand Up @@ -1408,7 +1408,7 @@ describe("assert", function () {
"fifth"
];
assert.equals(this.message("calledWith", this.obj.doSomething, expectedArg).replace(/ at.*/g, ""),
"expected doSomething to be called with arguments \n" +
"expected doSomething to be called with arguments \n" +
"[{\n" +
" first: \"a\",\n" +
color.red(" mismatchKey: true,\n") +
Expand All @@ -1423,7 +1423,7 @@ describe("assert", function () {
this.obj.doSomething(4);

assert.equals(this.message("calledWith", this.obj.doSomething, 1, 3).replace(/ at.*/g, ""),
"expected doSomething to be called with arguments \n" +
"expected doSomething to be called with arguments \n" +
color.red("4") + " " + color.green("1") + " \n" +
color.green("3"));
});
Expand All @@ -1432,7 +1432,7 @@ describe("assert", function () {
this.obj.doSomething(4, 3);

assert.equals(this.message("calledWith", this.obj.doSomething, 1).replace(/ at.*/g, ""),
"expected doSomething to be called with arguments \n" +
"expected doSomething to be called with arguments \n" +
color.red("4") + " " + color.green("1") + " \n" +
color.red("3"));
});
Expand Down Expand Up @@ -1467,7 +1467,7 @@ describe("assert", function () {
this.obj.doSomething(true);

assert.equals(this.message("calledWith", this.obj.doSomething, sinonMatch.falsy).replace(/ at.*/g, ""),
"expected doSomething to be called with arguments \n" +
"expected doSomething to be called with arguments \n" +
color.green("true") + " " + color.red("falsy"));
});

Expand Down Expand Up @@ -1510,22 +1510,22 @@ describe("assert", function () {
this.obj.doSomething();

assert.equals(this.message("calledWith", this.obj.doSomething, sinonMatch(true)).replace(/ at.*/g, ""),
"expected doSomething to be called with arguments \n " + color.red("match(true)"));
"expected doSomething to be called with arguments \n " + color.red("match(true)"));
});

it("assert.calledWith match number exception message", function () {
this.obj.doSomething();

assert.equals(this.message("calledWith", this.obj.doSomething, sinonMatch(123)).replace(/ at.*/g, ""),
"expected doSomething to be called with arguments \n " + color.red("match(123)"));
"expected doSomething to be called with arguments \n " + color.red("match(123)"));
});

it("assert.calledWith match string exception message", function () {
this.obj.doSomething();
var matcher = sinonMatch("Sinon");

assert.equals(this.message("calledWith", this.obj.doSomething, matcher).replace(/ at.*/g, ""),
"expected doSomething to be called with arguments \n " + color.red("match(\"Sinon\")"));
"expected doSomething to be called with arguments \n " + color.red("match(\"Sinon\")"));
});

it("assert.calledWith match regexp exception message", function () {
Expand All @@ -1549,7 +1549,7 @@ describe("assert", function () {
this.obj.doSomething(1, 3, "hey");

assert.equals(this.message("calledWithMatch", this.obj.doSomething, 4, 3, "hey").replace(/ at.*/g, ""),
"expected doSomething to be called with match \n" +
"expected doSomething to be called with match \n" +
color.red("1") + " " + color.green("4") + " \n" +
"3\n" +
"hey");
Expand All @@ -1560,7 +1560,7 @@ describe("assert", function () {
this.obj.doSomething(1, "hey");

assert.equals(this.message("alwaysCalledWith", this.obj.doSomething, 1, "hey").replace(/ at.*/g, ""),
"expected doSomething to always be called with arguments Call 1:\n" +
"expected doSomething to always be called with arguments Call 1:\n" +
"1\n" +
color.red("3") + " " + color.green("hey") + " \n" +
color.red("hey") + "\n" +
Expand Down Expand Up @@ -1588,7 +1588,7 @@ describe("assert", function () {
this.obj.doSomething(1, 3, "hey");

assert.equals(this.message("calledWithExactly", this.obj.doSomething, 1, 3).replace(/ at.*/g, ""),
"expected doSomething to be called with exact arguments \n" +
"expected doSomething to be called with exact arguments \n" +
"1\n" +
"3\n" +
color.red("hey"));
Expand All @@ -1599,7 +1599,7 @@ describe("assert", function () {
this.obj.doSomething(1, 3);

assert.equals(this.message("alwaysCalledWithExactly", this.obj.doSomething, 1, 3).replace(/ at.*/g, ""),
"expected doSomething to always be called with exact arguments Call 1:\n" +
"expected doSomething to always be called with exact arguments Call 1:\n" +
"1\n" +
"3\n" +
color.red("hey") + "\n" +
Expand All @@ -1612,15 +1612,15 @@ describe("assert", function () {
this.obj.doSomething(1, 2, 3);

assert.equals(this.message("neverCalledWith", this.obj.doSomething, 1, 2).replace(/ at.*/g, ""),
"expected doSomething to never be called with " +
"expected doSomething to never be called with " +
"arguments 1, 2\n doSomething(1, 2, 3)");
});

it("assert.neverCalledWithMatch exception message", function () {
this.obj.doSomething(1, 2, 3);

assert.equals(this.message("neverCalledWithMatch", this.obj.doSomething, 1, 2).replace(/ at.*/g, ""),
"expected doSomething to never be called with match " +
"expected doSomething to never be called with match " +
"1, 2\n doSomething(1, 2, 3)");
});

Expand All @@ -1629,7 +1629,7 @@ describe("assert", function () {
this.obj.doSomething(1, 3);

assert.equals(this.message("threw", this.obj.doSomething).replace(/ at.*/g, ""),
"doSomething did not throw exception\n" +
"doSomething did not throw exception\n" +
" doSomething(1, 3, hey)\n doSomething(1, 3)");
});

Expand All @@ -1638,13 +1638,13 @@ describe("assert", function () {
this.obj.doSomething(1, 3);

assert.equals(this.message("alwaysThrew", this.obj.doSomething).replace(/ at.*/g, ""),
"doSomething did not always throw exception\n" +
"doSomething did not always throw exception\n" +
" doSomething(1, 3, hey)\n doSomething(1, 3)");
});

it("assert.match exception message", function () {
assert.equals(this.message("match", { foo: 1 }, [1, 3]),
"expected value to match\n" +
"expected value to match\n" +
" expected = [1, 3]\n" +
" actual = { foo: 1 }");
});
Expand Down
10 changes: 5 additions & 5 deletions test/call-test.js
Expand Up @@ -864,11 +864,11 @@ describe("sinonSpy.call", function () {
}

run()
.then(function () {
assert.equals(stub2.getCall(0).toString().replace(/ at.*/g, ""), "stub(1) => 1");
done();
})
.catch( done );
.then(function () {
assert.equals(stub2.getCall(0).toString().replace(/ at.*/g, ""), "stub(1) => 1");
done();
})
.catch( done );
});
/* eslint-enable consistent-return */
});
Expand Down
4 changes: 2 additions & 2 deletions test/issues/issues-test.js
Expand Up @@ -130,7 +130,7 @@ describe("issues", function () {
// makes sure that Object.prototype.watch is set back to its old value
function restore(oldWatch) {
if (oldWatch) {
Object.prototype.watch = oldWatch; // eslint-disable-line no-extend-native
Object.prototype.watch = oldWatch; // eslint-disable-line no-extend-native
} else {
delete Object.prototype.watch;
}
Expand Down Expand Up @@ -203,7 +203,7 @@ describe("issues", function () {
this.sandbox.resetHistory();

spy();
assert.equals(spy.callCount, 1); // should not fail but fails
assert.equals(spy.callCount, 1); // should not fail but fails
});
});

Expand Down
6 changes: 3 additions & 3 deletions test/match-test.js
Expand Up @@ -1001,7 +1001,7 @@ describe("sinonMatch", function () {

assert(sinonMatch.isMatcher(numberOrString));
assert.equals(numberOrString.toString(),
"typeOf(\"number\").or(typeOf(\"string\"))");
"typeOf(\"number\").or(typeOf(\"string\"))");
});

it("requires matcher argument", function () {
Expand All @@ -1015,7 +1015,7 @@ describe("sinonMatch", function () {

assert(sinonMatch.isMatcher(abcOrDef));
assert.equals(abcOrDef.toString(),
"match(\"abc\").or(match(\"def\"))");
"match(\"abc\").or(match(\"def\"))");
});

it("returns true if either matcher matches", function () {
Expand Down Expand Up @@ -1060,7 +1060,7 @@ describe("sinonMatch", function () {

assert(sinonMatch.isMatcher(abcOrObj));
assert.equals(abcOrObj.toString(),
"match(\"abc\").or(match(a: 1))");
"match(\"abc\").or(match(a: 1))");
});

it("returns true if both matchers match", function () {
Expand Down
4 changes: 2 additions & 2 deletions test/sandbox-test.js
Expand Up @@ -346,8 +346,8 @@ describe("sinonSandbox", function () {
this.sandbox.clock.tick(10);

var xhr = window.XMLHttpRequest ?
new XMLHttpRequest() :
new ActiveXObject("Microsoft.XMLHTTP"); //eslint-disable-line no-undef
new XMLHttpRequest() :
new ActiveXObject("Microsoft.XMLHTTP"); //eslint-disable-line no-undef

assert.isFunction(this.obj.spy);
assert.isFunction(this.obj.stub);
Expand Down
10 changes: 5 additions & 5 deletions test/spy-test.js
Expand Up @@ -346,17 +346,17 @@ describe("spy", function () {
refute.defined(spy.getCall(3).args[2]);
["args", "callCount", "callId"].forEach(function (propName) {
assert.equals(spy.withArgs(1).getCall(0)[propName],
spy.getCall(1)[propName]);
spy.getCall(1)[propName]);
assert.equals(spy.withArgs(1).getCall(1)[propName],
spy.getCall(2)[propName]);
spy.getCall(2)[propName]);
assert.equals(spy.withArgs(1).getCall(2)[propName],
spy.getCall(3)[propName]);
spy.getCall(3)[propName]);
assert.isNull(spy.withArgs(1).getCall(3));
assert.equals(spy.withArgs(1, 1).getCall(0)[propName],
spy.getCall(2)[propName]);
spy.getCall(2)[propName]);
assert.isNull(spy.withArgs(1, 1).getCall(1));
assert.equals(spy.withArgs(1, 2).getCall(0)[propName],
spy.getCall(3)[propName]);
spy.getCall(3)[propName]);
assert.isNull(spy.withArgs(1, 2).getCall(1));
});

Expand Down

0 comments on commit 32e4516

Please sign in to comment.