Skip to content

Commit 4619e36

Browse files
committed
Use more ES6 in the tests
1 parent 8897a90 commit 4619e36

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

test/boolean.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ import conversions from "..";
55
describe("WebIDL boolean type", () => {
66
var sut = conversions["boolean"];
77

8-
it("should return `false` for `undefined`", function () {
8+
it("should return `false` for `undefined`", () => {
99
assert.strictEqual(sut(undefined), false);
1010
});
1111

12-
it("should return `false` for `null`", function () {
12+
it("should return `false` for `null`", () => {
1313
assert.strictEqual(sut(null), false);
1414
});
1515

16-
it("should return the input for a boolean", function () {
16+
it("should return the input for a boolean", () => {
1717
assert.strictEqual(sut(true), true);
1818
assert.strictEqual(sut(false), false);
1919
});
2020

21-
it("should return `false` for `+0`, `-0`, and `NaN`, but `true` other numbers", function () {
21+
it("should return `false` for `+0`, `-0`, and `NaN`, but `true` other numbers", () => {
2222
assert.strictEqual(sut(+0), false);
2323
assert.strictEqual(sut(-0), false);
2424
assert.strictEqual(sut(NaN), false);
@@ -27,20 +27,20 @@ describe("WebIDL boolean type", () => {
2727
assert.strictEqual(sut(-Infinity), true);
2828
});
2929

30-
it("should return `false` for empty strings, but `true` for other strings", function () {
30+
it("should return `false` for empty strings, but `true` for other strings", () => {
3131
assert.strictEqual(sut(""), false);
3232
assert.strictEqual(sut(" "), true);
3333
assert.strictEqual(sut("false"), true);
3434
});
3535

36-
it("should return `true` for symbols", function () {
36+
it("should return `true` for symbols", () => {
3737
assert.strictEqual(sut(Symbol()), true);
3838
});
3939

40-
it("should return `true` for objects", function () {
40+
it("should return `true` for objects", () => {
4141
assert.strictEqual(sut({}), true);
4242
assert.strictEqual(sut(Object.create(null)), true);
43-
assert.strictEqual(sut(function () { }), true);
43+
assert.strictEqual(sut(() => { }), true);
4444
assert.strictEqual(sut(new Boolean(false)), true);
4545
assert.strictEqual(sut(new Number(0)), true);
4646
});

test/dom-string.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@ import conversions from "..";
55
describe("WebIDL DOMString type", () => {
66
var sut = conversions["DOMString"];
77

8-
it("should return `\"undefined\"` for `undefined`", function () {
8+
it("should return `\"undefined\"` for `undefined`", () => {
99
assert.strictEqual(sut(undefined), "undefined");
1010
});
1111

12-
it("should return `\"null\"` for `null`", function () {
12+
it("should return `\"null\"` for `null`", () => {
1313
assert.strictEqual(sut(null), "null");
1414
});
1515

16-
it("should return `\"true\"` for `true`", function () {
16+
it("should return `\"true\"` for `true`", () => {
1717
assert.strictEqual(sut(true), "true");
1818
});
1919

20-
it("should return `\"false\"` for `false`", function () {
20+
it("should return `\"false\"` for `false`", () => {
2121
assert.strictEqual(sut(false), "false");
2222
});
2323

24-
it("should return the correct number formatting for numbers", function () {
24+
it("should return the correct number formatting for numbers", () => {
2525
assert.strictEqual(sut(NaN), "NaN");
2626
assert.strictEqual(sut(+0), "0");
2727
assert.strictEqual(sut(-0), "0");
@@ -31,19 +31,19 @@ describe("WebIDL DOMString type", () => {
3131
assert.strictEqual(sut(-10), "-10");
3232
});
3333

34-
it("should return the input for a string", function () {
34+
it("should return the input for a string", () => {
3535
assert.strictEqual(sut(""), "");
3636
assert.strictEqual(sut("whee"), "whee");
3737
});
3838

39-
it("should throw a TypeError for a symbol", function () {
40-
assert.throws(function () {
39+
it("should throw a TypeError for a symbol", () => {
40+
assert.throws(() => {
4141
sut(new Symbol());
4242
}, TypeError);
4343
});
4444

45-
it("should prefer toString to valueOf on objects", function () {
46-
var o = { valueOf: function () { return 5; }, toString: function () { return "foo"; } };
45+
it("should prefer toString to valueOf on objects", () => {
46+
var o = { valueOf() { return 5; }, toString() { return "foo"; } };
4747
assert.strictEqual(sut(o), "foo");
4848
});
4949
});

0 commit comments

Comments
 (0)