Update empty and notEmpty specs for better IE11 support

This commit is contained in:
Gregg Van Hove
2018-02-15 17:22:56 -08:00
parent c974c4740c
commit d8c154a2c6
2 changed files with 15 additions and 3 deletions

View File

@@ -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);
});
});

View File

@@ -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);
});
});