Skip to content

Commit

Permalink
Fix test to be displayed only accoding type defined
Browse files Browse the repository at this point in the history
  • Loading branch information
btd committed Aug 28, 2017
1 parent 0209a35 commit 7c6e9ff
Showing 1 changed file with 28 additions and 27 deletions.
55 changes: 28 additions & 27 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,19 +422,19 @@ it("Check object prototypes", function() {
ne(nb1, nb2);
});

it("typed arrays and array buffer", function() {
if (typeof Uint8Array !== "undefined") {
if (typeof Uint8Array !== "undefined") {
it("typed arrays and array buffer", function() {
var arr1 = new Uint8Array([21, 31]);
var arr2 = new Uint8Array([21, 31]);

eq(arr1, arr2);

eq(arr1.buffer, arr2.buffer);
}
});
});
}

it("es6 sets", function() {
if (typeof Set !== "undefined") {
if (typeof Set !== "undefined") {
it("es6 sets", function() {
var s1 = new Set([1, 2, 3]);
var s2 = new Set([1, 2, 3]);
var s3 = new Set(["a", "b", "c"]);
Expand All @@ -451,11 +451,12 @@ it("es6 sets", function() {

ne(s1, s5);
eq(s5, s6);
}
});
eq(s6, s5);
});
}

it("es6 maps", function() {
if (typeof Map !== "undefined") {
if (typeof Map !== "undefined") {
it("es6 maps", function() {
var m1 = new Map([[1, 1], [2, 2], [3, 3]]);
var m2 = new Map([[1, 1], [2, 2], [3, 3]]);
var m3 = new Map([[1, 2], [2, 3], [3, 4]]);
Expand All @@ -481,43 +482,43 @@ it("es6 maps", function() {

ne(m7, m8);
ne(m9, m8);
}
});

it("es WeakMap, WeakSet", function() {
const a = new WeakSet();
const b = new WeakSet();
eq(a, b);
});
});
}
if (typeof WeakSet !== "undefined") {
it("es WeakMap, WeakSet", function() {
var a = new WeakSet();
var b = new WeakSet();
eq(a, b);
});
}

it("should treat -0 and +0 as not equal when param not passed", function() {
eq(-0, +0);

ne(-0, +0, { plusZeroAndMinusZeroEqual: false });
});

it("should work with Symbols", function() {
if (typeof Symbol !== "undefined") {
if (typeof Symbol !== "undefined") {
it("should work with Symbols", function() {
ne([Symbol()], [Symbol()]);
eq([Symbol.for("a")], [Symbol.for("a")]);
ne(Symbol(), Symbol());
ne(Symbol("abc"), Symbol("abc"));
eq(Symbol.for("a"), Symbol.for("a"));
ne(Symbol.for("a"), Symbol.for("b"));
}
});
});
}

it("should support node Buffer", function() {
if (typeof Buffer !== "undefined") {
if (typeof Buffer !== "undefined") {
it("should support node Buffer", function() {
var b1 = new Buffer("abc", "utf8");
var b2 = new Buffer("abc", "utf8");
var b3 = new Buffer("acc", "utf8");

eq(b1, b2);
ne(b1, b3);
}
});

});
}
it("should not assume object with only the same properties are equal", function() {
var F = function(a, b) {
this.a = a;
Expand Down

0 comments on commit 7c6e9ff

Please sign in to comment.