Run Prettier on all files

This commit is contained in:
Steve Gravrock
2020-09-29 18:05:38 -07:00
parent 7d5ca27b9d
commit d27bb8fa96
108 changed files with 4399 additions and 2926 deletions

View File

@@ -1,6 +1,7 @@
/* eslint-disable compat/compat */
describe('SetContaining', function() {
function SetI(iterable) { // for IE11
function SetI(iterable) {
// for IE11
var set = new Set();
iterable.forEach(function(v) {
set.add(v);
@@ -12,7 +13,6 @@ describe('SetContaining', function() {
jasmine.getEnv().requireFunctioningSets();
});
it('matches any actual set to an empty set', function() {
var actualSet = new SetI(['foo', 'bar']);
var containing = new jasmineUnderTest.SetContaining(new Set());
@@ -21,13 +21,9 @@ describe('SetContaining', function() {
});
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 SetI([{ foo: 'bar' }, 'baz', [1, 2, 3]]);
var containingSet = new SetI([
[1, 2, 3], {'foo': 'bar'}
]);
var containingSet = new SetI([[1, 2, 3], { foo: 'bar' }]);
var containing = new jasmineUnderTest.SetContaining(containingSet);
var matchersUtil = new jasmineUnderTest.MatchersUtil();
@@ -35,13 +31,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 SetI([{ foo: 'bar' }, 'baz', [1, 2, 3]]);
var containingSet = new SetI([
[1, 2], {'foo': 'bar'}
]);
var containingSet = new SetI([[1, 2], { foo: 'bar' }]);
var containing = new jasmineUnderTest.SetContaining(containingSet);
var matchersUtil = new jasmineUnderTest.MatchersUtil();
@@ -49,13 +41,11 @@ 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 SetI([[1, 2, 3, 4], 'other', 'foo1']);
var containingSet = new SetI([
jasmineUnderTest.stringMatching(/^foo\d/),
jasmineUnderTest.arrayContaining([2, 3]),
jasmineUnderTest.arrayContaining([2, 3])
]);
var containing = new jasmineUnderTest.SetContaining(containingSet);
var matchersUtil = new jasmineUnderTest.MatchersUtil();
@@ -64,13 +54,11 @@ 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 SetI(['a-foo1', [1, 2, 3, 4], 'other']);
var containingSet = new SetI([
jasmine.stringMatching(/^foo\d/),
jasmine.arrayContaining([2, 3]),
jasmine.arrayContaining([2, 3])
]);
var containing = new jasmineUnderTest.SetContaining(containingSet);
var matchersUtil = new jasmineUnderTest.MatchersUtil();
@@ -79,12 +67,11 @@ describe('SetContaining', function() {
});
it('matches recursively', function() {
var actualSet = new SetI([
'foo', new SetI([1, 'bar', 2]), 'other'
]);
var actualSet = new SetI(['foo', new SetI([1, 'bar', 2]), 'other']);
var containingSet = new SetI([
new jasmineUnderTest.SetContaining(new SetI(['bar'])), 'foo'
new jasmineUnderTest.SetContaining(new SetI(['bar'])),
'foo'
]);
var containing = new jasmineUnderTest.SetContaining(containingSet);
var matchersUtil = new jasmineUnderTest.MatchersUtil();
@@ -95,25 +82,37 @@ describe('SetContaining', function() {
it('uses custom equality testers', function() {
function tester(a, b) {
// treat all negative numbers as equal
return (typeof a == 'number' && typeof b == 'number') ? (a < 0 && b < 0) : a === b;
return typeof a == 'number' && typeof b == 'number'
? a < 0 && b < 0
: a === b;
}
var actualSet = new SetI(['foo', -1]);
var containing = new jasmineUnderTest.SetContaining(new SetI([-2, 'foo']));
var matchersUtil = new jasmineUnderTest.MatchersUtil({customTesters: [tester]});
var matchersUtil = new jasmineUnderTest.MatchersUtil({
customTesters: [tester]
});
expect(containing.asymmetricMatch(actualSet, matchersUtil)).toBe(true);
});
it('does not match when actual is not a set', function() {
var containingSet = new SetI(['foo']);
expect(new jasmineUnderTest.SetContaining(containingSet).asymmetricMatch('foo')).toBe(false);
expect(new jasmineUnderTest.SetContaining(containingSet).asymmetricMatch(1)).toBe(false);
expect(new jasmineUnderTest.SetContaining(containingSet).asymmetricMatch(['foo'])).toBe(false);
expect(
new jasmineUnderTest.SetContaining(containingSet).asymmetricMatch('foo')
).toBe(false);
expect(
new jasmineUnderTest.SetContaining(containingSet).asymmetricMatch(1)
).toBe(false);
expect(
new jasmineUnderTest.SetContaining(containingSet).asymmetricMatch(['foo'])
).toBe(false);
});
it('throws an error when sample is not a set', function() {
expect(function() {
new jasmineUnderTest.SetContaining({'foo': 'bar'}).asymmetricMatch(new Set());
new jasmineUnderTest.SetContaining({ foo: 'bar' }).asymmetricMatch(
new Set()
);
}).toThrowError(/You must provide a set/);
});