From d8c154a2c66c5749b99f41dd58473d1885983359 Mon Sep 17 00:00:00 2001 From: Gregg Van Hove Date: Thu, 15 Feb 2018 17:22:56 -0800 Subject: [PATCH] Update empty and notEmpty specs for better IE11 support --- spec/core/asymmetric_equality/EmptySpec.js | 7 +++++++ spec/core/asymmetric_equality/NotEmptySpec.js | 11 ++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/spec/core/asymmetric_equality/EmptySpec.js b/spec/core/asymmetric_equality/EmptySpec.js index fbfe4823..2946057b 100644 --- a/spec/core/asymmetric_equality/EmptySpec.js +++ b/spec/core/asymmetric_equality/EmptySpec.js @@ -24,15 +24,21 @@ describe("Empty", function () { it("matches an empty map", function () { jasmine.getEnv().requireFunctioningMaps(); var empty = new jasmineUnderTest.Empty(); + var fullMap = new Map(); + fullMap.set('thing', 2); expect(empty.asymmetricMatch(new Map())).toBe(true); + expect(empty.asymmetricMatch(fullMap)).toBe(false); }); it("matches an empty map", function () { jasmine.getEnv().requireFunctioningSets(); var empty = new jasmineUnderTest.Empty(); + var fullSet = new Set(); + fullSet.add(3); expect(empty.asymmetricMatch(new Set())).toBe(true); + expect(empty.asymmetricMatch(fullSet)).toBe(false); }); it("matches an empty typed array", function() { @@ -40,5 +46,6 @@ describe("Empty", function () { var empty = new jasmineUnderTest.Empty(); expect(empty.asymmetricMatch(new Int16Array())).toBe(true); + expect(empty.asymmetricMatch(new Int16Array([1,2]))).toBe(false); }); }); diff --git a/spec/core/asymmetric_equality/NotEmptySpec.js b/spec/core/asymmetric_equality/NotEmptySpec.js index 0ae6443e..85bdce6c 100644 --- a/spec/core/asymmetric_equality/NotEmptySpec.js +++ b/spec/core/asymmetric_equality/NotEmptySpec.js @@ -24,19 +24,23 @@ describe("NotEmpty", function () { it("matches a non empty map", function () { jasmine.getEnv().requireFunctioningMaps(); var notEmpty = new jasmineUnderTest.NotEmpty(); - var fullMap = new Map([['one',1]]); + var fullMap = new Map(); + fullMap.set('one', 1); var emptyMap = new Map(); expect(notEmpty.asymmetricMatch(fullMap)).toBe(true); expect(notEmpty.asymmetricMatch(emptyMap)).toBe(false); }); - it("matches a non empty map", function () { + it("matches a non empty set", function () { jasmine.getEnv().requireFunctioningMaps(); var notEmpty = new jasmineUnderTest.NotEmpty(); - var filledSet = new Set([1,2,2,2,2,34]); + var filledSet = new Set(); + filledSet.add(1); + var emptySet = new Set(); expect(notEmpty.asymmetricMatch(filledSet)).toBe(true); + expect(notEmpty.asymmetricMatch(emptySet)).toBe(false); }); it("matches an empty typed array", function() { @@ -44,5 +48,6 @@ describe("NotEmpty", function () { var notEmpty = new jasmineUnderTest.NotEmpty(); expect(notEmpty.asymmetricMatch(new Int16Array([1,2,3]))).toBe(true); + expect(notEmpty.asymmetricMatch(new Int16Array())).toBe(false); }); });