Removed support for Internet Explorer
This commit is contained in:
@@ -48,11 +48,9 @@ describe('Any', function() {
|
||||
});
|
||||
|
||||
it('matches a Symbol', function() {
|
||||
jasmine.getEnv().requireFunctioningSymbols();
|
||||
var any = new jasmineUnderTest.Any(Symbol);
|
||||
|
||||
var any = new jasmineUnderTest.Any(Symbol); // eslint-disable-line compat/compat
|
||||
|
||||
expect(any.asymmetricMatch(Symbol())).toBe(true); // eslint-disable-line compat/compat
|
||||
expect(any.asymmetricMatch(Symbol())).toBe(true);
|
||||
});
|
||||
|
||||
it('matches another constructed object', function() {
|
||||
|
||||
@@ -42,11 +42,9 @@ describe('Anything', function() {
|
||||
});
|
||||
|
||||
it('matches a Symbol', function() {
|
||||
jasmine.getEnv().requireFunctioningSymbols();
|
||||
|
||||
var anything = new jasmineUnderTest.Anything();
|
||||
|
||||
expect(anything.asymmetricMatch(Symbol())).toBe(true); // eslint-disable-line compat/compat
|
||||
expect(anything.asymmetricMatch(Symbol())).toBe(true);
|
||||
});
|
||||
|
||||
it("doesn't match undefined", function() {
|
||||
|
||||
@@ -1,28 +1,19 @@
|
||||
describe('MapContaining', function() {
|
||||
function MapI(iterable) {
|
||||
// for IE11
|
||||
var map = new Map();
|
||||
iterable.forEach(function(kv) {
|
||||
map.set(kv[0], kv[1]);
|
||||
});
|
||||
return map;
|
||||
}
|
||||
|
||||
it('matches any actual map to an empty map', function() {
|
||||
var actualMap = new MapI([['foo', 'bar']]);
|
||||
var actualMap = new Map([['foo', 'bar']]);
|
||||
var containing = new jasmineUnderTest.MapContaining(new Map());
|
||||
|
||||
expect(containing.asymmetricMatch(actualMap)).toBe(true);
|
||||
});
|
||||
|
||||
it('matches when all the key/value pairs in sample have matches in actual', function() {
|
||||
var actualMap = new MapI([
|
||||
var actualMap = new Map([
|
||||
['foo', [1, 2, 3]],
|
||||
[{ foo: 'bar' }, 'baz'],
|
||||
['other', 'any']
|
||||
]);
|
||||
|
||||
var containingMap = new MapI([[{ foo: 'bar' }, 'baz'], ['foo', [1, 2, 3]]]);
|
||||
var containingMap = new Map([[{ foo: 'bar' }, 'baz'], ['foo', [1, 2, 3]]]);
|
||||
var containing = new jasmineUnderTest.MapContaining(containingMap);
|
||||
var matchersUtil = new jasmineUnderTest.MatchersUtil();
|
||||
|
||||
@@ -30,12 +21,12 @@ describe('MapContaining', function() {
|
||||
});
|
||||
|
||||
it('does not match when a key is not in actual', function() {
|
||||
var actualMap = new MapI([
|
||||
var actualMap = new Map([
|
||||
['foo', [1, 2, 3]],
|
||||
[{ foo: 'not a bar' }, 'baz']
|
||||
]);
|
||||
|
||||
var containingMap = new MapI([[{ foo: 'bar' }, 'baz'], ['foo', [1, 2, 3]]]);
|
||||
var containingMap = new Map([[{ foo: 'bar' }, 'baz'], ['foo', [1, 2, 3]]]);
|
||||
var containing = new jasmineUnderTest.MapContaining(containingMap);
|
||||
var matchersUtil = new jasmineUnderTest.MatchersUtil();
|
||||
|
||||
@@ -43,9 +34,9 @@ describe('MapContaining', function() {
|
||||
});
|
||||
|
||||
it('does not match when a value is not in actual', function() {
|
||||
var actualMap = new MapI([['foo', [1, 2, 3]], [{ foo: 'bar' }, 'baz']]);
|
||||
var actualMap = new Map([['foo', [1, 2, 3]], [{ foo: 'bar' }, 'baz']]);
|
||||
|
||||
var containingMap = new MapI([[{ foo: 'bar' }, 'baz'], ['foo', [1, 2]]]);
|
||||
var containingMap = new Map([[{ foo: 'bar' }, 'baz'], ['foo', [1, 2]]]);
|
||||
var containing = new jasmineUnderTest.MapContaining(containingMap);
|
||||
var matchersUtil = new jasmineUnderTest.MatchersUtil();
|
||||
|
||||
@@ -53,13 +44,13 @@ describe('MapContaining', function() {
|
||||
});
|
||||
|
||||
it('matches when all the key/value pairs in sample have asymmetric matches in actual', function() {
|
||||
var actualMap = new MapI([
|
||||
var actualMap = new Map([
|
||||
['foo1', 'not a bar'],
|
||||
['foo2', 'bar'],
|
||||
['baz', [1, 2, 3, 4]]
|
||||
]);
|
||||
|
||||
var containingMap = new MapI([
|
||||
var containingMap = new Map([
|
||||
[jasmineUnderTest.stringMatching(/^foo\d/), 'bar'],
|
||||
['baz', jasmineUnderTest.arrayContaining([2, 3])]
|
||||
]);
|
||||
@@ -70,9 +61,9 @@ describe('MapContaining', function() {
|
||||
});
|
||||
|
||||
it('does not match when a key in sample has no asymmetric matches in actual', function() {
|
||||
var actualMap = new MapI([['a-foo1', 'bar'], ['baz', [1, 2, 3, 4]]]);
|
||||
var actualMap = new Map([['a-foo1', 'bar'], ['baz', [1, 2, 3, 4]]]);
|
||||
|
||||
var containingMap = new MapI([
|
||||
var containingMap = new Map([
|
||||
[jasmineUnderTest.stringMatching(/^foo\d/), 'bar'],
|
||||
['baz', jasmineUnderTest.arrayContaining([2, 3])]
|
||||
]);
|
||||
@@ -83,9 +74,9 @@ describe('MapContaining', function() {
|
||||
});
|
||||
|
||||
it('does not match when a value in sample has no asymmetric matches in actual', function() {
|
||||
var actualMap = new MapI([['foo1', 'bar'], ['baz', [1, 2, 3, 4]]]);
|
||||
var actualMap = new Map([['foo1', 'bar'], ['baz', [1, 2, 3, 4]]]);
|
||||
|
||||
var containingMap = new MapI([
|
||||
var containingMap = new Map([
|
||||
[jasmineUnderTest.stringMatching(/^foo\d/), 'bar'],
|
||||
['baz', jasmineUnderTest.arrayContaining([4, 5])]
|
||||
]);
|
||||
@@ -96,15 +87,15 @@ describe('MapContaining', function() {
|
||||
});
|
||||
|
||||
it('matches recursively', function() {
|
||||
var actualMap = new MapI([
|
||||
['foo', new MapI([['foo1', 1], ['foo2', 2]])],
|
||||
[new MapI([[1, 'bar1'], [2, 'bar2']]), 'bar'],
|
||||
var actualMap = new Map([
|
||||
['foo', new Map([['foo1', 1], ['foo2', 2]])],
|
||||
[new Map([[1, 'bar1'], [2, 'bar2']]), 'bar'],
|
||||
['other', 'any']
|
||||
]);
|
||||
|
||||
var containingMap = new MapI([
|
||||
['foo', new jasmineUnderTest.MapContaining(new MapI([['foo1', 1]]))],
|
||||
[new jasmineUnderTest.MapContaining(new MapI([[2, 'bar2']])), 'bar']
|
||||
var containingMap = new Map([
|
||||
['foo', new jasmineUnderTest.MapContaining(new Map([['foo1', 1]]))],
|
||||
[new jasmineUnderTest.MapContaining(new Map([[2, 'bar2']])), 'bar']
|
||||
]);
|
||||
var containing = new jasmineUnderTest.MapContaining(containingMap);
|
||||
var matchersUtil = new jasmineUnderTest.MatchersUtil();
|
||||
@@ -119,10 +110,8 @@ describe('MapContaining', function() {
|
||||
? a < 0 && b < 0
|
||||
: a === b;
|
||||
}
|
||||
var actualMap = new MapI([['foo', -1]]);
|
||||
var containing = new jasmineUnderTest.MapContaining(
|
||||
new MapI([['foo', -2]])
|
||||
);
|
||||
var actualMap = new Map([['foo', -1]]);
|
||||
var containing = new jasmineUnderTest.MapContaining(new Map([['foo', -2]]));
|
||||
var matchersUtil = new jasmineUnderTest.MatchersUtil({
|
||||
customTesters: [tester]
|
||||
});
|
||||
@@ -131,7 +120,7 @@ describe('MapContaining', function() {
|
||||
});
|
||||
|
||||
it('does not match when actual is not a map', function() {
|
||||
var containingMap = new MapI([['foo', 'bar']]);
|
||||
var containingMap = new Map([['foo', 'bar']]);
|
||||
expect(
|
||||
new jasmineUnderTest.MapContaining(containingMap).asymmetricMatch('foo')
|
||||
).toBe(false);
|
||||
|
||||
@@ -1,24 +1,15 @@
|
||||
describe('SetContaining', function() {
|
||||
function SetI(iterable) {
|
||||
// for IE11
|
||||
var set = new Set();
|
||||
iterable.forEach(function(v) {
|
||||
set.add(v);
|
||||
});
|
||||
return set;
|
||||
}
|
||||
|
||||
it('matches any actual set to an empty set', function() {
|
||||
var actualSet = new SetI(['foo', 'bar']);
|
||||
var actualSet = new Set(['foo', 'bar']);
|
||||
var containing = new jasmineUnderTest.SetContaining(new Set());
|
||||
|
||||
expect(containing.asymmetricMatch(actualSet)).toBe(true);
|
||||
});
|
||||
|
||||
it('matches when all the values in sample have matches in actual', function() {
|
||||
var actualSet = new SetI([{ foo: 'bar' }, 'baz', [1, 2, 3]]);
|
||||
var actualSet = new Set([{ foo: 'bar' }, 'baz', [1, 2, 3]]);
|
||||
|
||||
var containingSet = new SetI([[1, 2, 3], { foo: 'bar' }]);
|
||||
var containingSet = new Set([[1, 2, 3], { foo: 'bar' }]);
|
||||
var containing = new jasmineUnderTest.SetContaining(containingSet);
|
||||
var matchersUtil = new jasmineUnderTest.MatchersUtil();
|
||||
|
||||
@@ -26,9 +17,9 @@ describe('SetContaining', function() {
|
||||
});
|
||||
|
||||
it('does not match when a value is not in actual', function() {
|
||||
var actualSet = new SetI([{ foo: 'bar' }, 'baz', [1, 2, 3]]);
|
||||
var actualSet = new Set([{ foo: 'bar' }, 'baz', [1, 2, 3]]);
|
||||
|
||||
var containingSet = new SetI([[1, 2], { foo: 'bar' }]);
|
||||
var containingSet = new Set([[1, 2], { foo: 'bar' }]);
|
||||
var containing = new jasmineUnderTest.SetContaining(containingSet);
|
||||
var matchersUtil = new jasmineUnderTest.MatchersUtil();
|
||||
|
||||
@@ -36,9 +27,9 @@ describe('SetContaining', function() {
|
||||
});
|
||||
|
||||
it('matches when all the values in sample have asymmetric matches in actual', function() {
|
||||
var actualSet = new SetI([[1, 2, 3, 4], 'other', 'foo1']);
|
||||
var actualSet = new Set([[1, 2, 3, 4], 'other', 'foo1']);
|
||||
|
||||
var containingSet = new SetI([
|
||||
var containingSet = new Set([
|
||||
jasmineUnderTest.stringMatching(/^foo\d/),
|
||||
jasmineUnderTest.arrayContaining([2, 3])
|
||||
]);
|
||||
@@ -49,9 +40,9 @@ describe('SetContaining', function() {
|
||||
});
|
||||
|
||||
it('does not match when a value in sample has no asymmetric matches in actual', function() {
|
||||
var actualSet = new SetI(['a-foo1', [1, 2, 3, 4], 'other']);
|
||||
var actualSet = new Set(['a-foo1', [1, 2, 3, 4], 'other']);
|
||||
|
||||
var containingSet = new SetI([
|
||||
var containingSet = new Set([
|
||||
jasmine.stringMatching(/^foo\d/),
|
||||
jasmine.arrayContaining([2, 3])
|
||||
]);
|
||||
@@ -62,10 +53,10 @@ describe('SetContaining', function() {
|
||||
});
|
||||
|
||||
it('matches recursively', function() {
|
||||
var actualSet = new SetI(['foo', new SetI([1, 'bar', 2]), 'other']);
|
||||
var actualSet = new Set(['foo', new Set([1, 'bar', 2]), 'other']);
|
||||
|
||||
var containingSet = new SetI([
|
||||
new jasmineUnderTest.SetContaining(new SetI(['bar'])),
|
||||
var containingSet = new Set([
|
||||
new jasmineUnderTest.SetContaining(new Set(['bar'])),
|
||||
'foo'
|
||||
]);
|
||||
var containing = new jasmineUnderTest.SetContaining(containingSet);
|
||||
@@ -81,8 +72,8 @@ describe('SetContaining', function() {
|
||||
? a < 0 && b < 0
|
||||
: a === b;
|
||||
}
|
||||
var actualSet = new SetI(['foo', -1]);
|
||||
var containing = new jasmineUnderTest.SetContaining(new SetI([-2, 'foo']));
|
||||
var actualSet = new Set(['foo', -1]);
|
||||
var containing = new jasmineUnderTest.SetContaining(new Set([-2, 'foo']));
|
||||
var matchersUtil = new jasmineUnderTest.MatchersUtil({
|
||||
customTesters: [tester]
|
||||
});
|
||||
@@ -91,7 +82,7 @@ describe('SetContaining', function() {
|
||||
});
|
||||
|
||||
it('does not match when actual is not a set', function() {
|
||||
var containingSet = new SetI(['foo']);
|
||||
var containingSet = new Set(['foo']);
|
||||
expect(
|
||||
new jasmineUnderTest.SetContaining(containingSet).asymmetricMatch('foo')
|
||||
).toBe(false);
|
||||
|
||||
Reference in New Issue
Block a user