From 0033de72f398e801ea2f6004bb17e6c3a1660f5f Mon Sep 17 00:00:00 2001 From: Andreas Lind Date: Thu, 19 Nov 2020 23:56:36 +0100 Subject: [PATCH] prettier --write '**/*.js' --- .eslintrc.js | 10 +- lib/unexpectedMap.js | 64 +++--- test/assertions/Map.to-be-empty.spec.js | 4 +- test/assertions/Map.to-equal.spec.js | 8 +- .../Map.to-have-values-satisfying.spec.js | 26 +-- test/assertions/Map.to-satisfy.spec.js | 198 +++++++++--------- test/common/node.js | 4 +- test/types/Map-type.spec.js | 40 ++-- 8 files changed, 174 insertions(+), 180 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 414efea..0ab803b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -5,16 +5,16 @@ const config = { 'import/no-unresolved': ['error', { commonjs: true }], 'mocha/no-exclusive-tests': 'error', 'mocha/no-nested-tests': 'error', - 'mocha/no-identical-title': 'error' + 'mocha/no-identical-title': 'error', }, overrides: [ { files: ['test/**/*.js'], env: { - mocha: true - } - } - ] + mocha: true, + }, + }, + ], }; module.exports = config; diff --git a/lib/unexpectedMap.js b/lib/unexpectedMap.js index 0e2bcdc..588b0e3 100644 --- a/lib/unexpectedMap.js +++ b/lib/unexpectedMap.js @@ -20,7 +20,7 @@ function getFunctionName(f) { function retrieveMapValues(theMap) { const values = []; - theMap.forEach(value => { + theMap.forEach((value) => { values.push(value); }); return values; @@ -33,22 +33,16 @@ class MapValue { } function createUnexpectedMap(expect) { - expect.addStyle('propertyForMap', function(key, inspectedValue) { - this.text('[') - .appendInspected(key) - .text(',') - .sp() - .append(inspectedValue); + expect.addStyle('propertyForMap', function (key, inspectedValue) { + this.text('[').appendInspected(key).text(',').sp().append(inspectedValue); }); - expect.addStyle('propertyForMapInSatisfy', function( + expect.addStyle('propertyForMapInSatisfy', function ( key, inspectedValue, isValueDiff ) { - this.text('[') - .appendInspected(key) - .text(','); + this.text('[').appendInspected(key).text(','); if (isValueDiff) { this.nl().sp(2); } else { @@ -82,7 +76,7 @@ function createUnexpectedMap(expect) { }, suffix(output) { return output; - } + }, }); const objectType = expect.getType('object'); @@ -140,7 +134,7 @@ function createUnexpectedMap(expect) { return output; }, getKeys: Object.getOwnPropertySymbols - ? function(obj) { + ? function (obj) { const keys = this.retrieveKeys(obj); const symbols = Object.getOwnPropertySymbols(obj); if (symbols.length > 0) { @@ -149,7 +143,7 @@ function createUnexpectedMap(expect) { return keys; } } - : function(obj) { + : function (obj) { return this.retrieveKeys(obj); }, hasKey(obj, key) { @@ -165,7 +159,7 @@ function createUnexpectedMap(expect) { uniqueKeys(subjectKeys, valueKeys) { const subjectKeysSet = new Set(subjectKeys); const uniqueValueKeys = valueKeys.filter( - valueKey => !subjectKeysSet.has(valueKey) + (valueKey) => !subjectKeysSet.has(valueKey) ); const uniqueKeys = [...subjectKeys, ...uniqueValueKeys]; @@ -174,7 +168,7 @@ function createUnexpectedMap(expect) { }, valueForKey(obj, key) { return new MapValue(obj.get(key)); - } + }, }); expect.addAssertion(' [not] to be empty', (expect, subject) => { @@ -190,12 +184,12 @@ function createUnexpectedMap(expect) { () => { expect(expect.equal(value, subject), 'to be truthy'); }, - e => { + (e) => { expect.fail({ label: 'should equal', diff(output, diff) { return diff(subject, value); - } + }, }); } ); @@ -203,7 +197,7 @@ function createUnexpectedMap(expect) { expect.addAssertion(' to equal ', (expect, actual, expected) => { expect.fail({ - diff: output => { + diff: (output) => { return output .text('Mismatching constructors ') .text( @@ -215,7 +209,7 @@ function createUnexpectedMap(expect) { (expected.constructor && getFunctionName(expected.constructor)) || expected.constructor ); - } + }, }); }); @@ -256,17 +250,17 @@ function createUnexpectedMap(expect) { .all([ expect.promise(() => { if (expect.flags.exhaustively) { - const nonOwnKeysWithDefinedValues = keys.filter(key => { + const nonOwnKeysWithDefinedValues = keys.filter((key) => { return ( !Object.prototype.hasOwnProperty.call(subject, key) && typeof subject[key] !== 'undefined' ); }); - const valueKeysWithDefinedValues = keys.filter(key => { + const valueKeysWithDefinedValues = keys.filter((key) => { const valueKey = value.get(key); return typeof valueKey !== 'undefined'; }); - const subjectKeysWithDefinedValues = subjectKeys.filter(key => { + const subjectKeysWithDefinedValues = subjectKeys.filter((key) => { const subjectKey = subject.get(key); return typeof subjectKey !== 'undefined'; }); @@ -278,7 +272,7 @@ function createUnexpectedMap(expect) { ); } }), - expect.promise.all(promisesInFlight) + expect.promise.all(promisesInFlight), ]) .caught(() => { return expect.promise.settle(promisesInFlight).then(() => { @@ -288,7 +282,7 @@ function createUnexpectedMap(expect) { const valueKeys = valueType.getKeys(value); const uniqueKeys = subjectType .uniqueKeys(subjectKeys, valueKeys) - .filter(key => { + .filter((key) => { const valueKey = value.get(key); const subjectHasKey = subject.has(key); // Skip missing keys expected to be missing so they don't get rendered in the diff @@ -310,7 +304,7 @@ function createUnexpectedMap(expect) { output .nl(index > 0 ? 1 : 0) .i() - .block(function() { + .block(function () { let valueOutput; const annotation = output.clone(); let conflicting; @@ -416,7 +410,7 @@ function createUnexpectedMap(expect) { valueOutput.sp(); } - valueOutput.annotationBlock(function() { + valueOutput.annotationBlock(function () { this.append(annotation); }); } @@ -435,7 +429,7 @@ function createUnexpectedMap(expect) { if (isExhaustiveValueDiff) { output - .annotationBlock(function() { + .annotationBlock(function () { this.append(annotation); }) .text(':') @@ -454,7 +448,7 @@ function createUnexpectedMap(expect) { return output .nl(suffixOutput.isEmpty() ? 0 : 1) .append(suffixOutput); - } + }, }); }); }); @@ -464,7 +458,7 @@ function createUnexpectedMap(expect) { expect.addAssertion( [ ' to have values [exhaustively] satisfying ', - ' to have values [exhaustively] satisfying ' + ' to have values [exhaustively] satisfying ', ], (expect, subject, nextArg) => { expect.errorMode = 'nested'; @@ -473,11 +467,11 @@ function createUnexpectedMap(expect) { const expected = new Map(); const keys = expect.subjectType.getKeys(subject); - keys.forEach(key => { + keys.forEach((key) => { if (typeof nextArg === 'string') { expected.set( key, - expect.it(s => expect.shift(s)) + expect.it((s) => expect.shift(s)) ); } else { expected.set(key, nextArg); @@ -488,7 +482,7 @@ function createUnexpectedMap(expect) { () => { return expect(subject, 'to [exhaustively] satisfy', expected); }, - err => { + (err) => { expect.fail({ message(output) { output.append( @@ -499,7 +493,7 @@ function createUnexpectedMap(expect) { const diff = err.getDiff({ output }); diff.inline = true; return diff; - } + }, }); } ); @@ -516,5 +510,5 @@ function createUnexpectedMap(expect) { module.exports = { name: 'unexpected-map', - installInto: createUnexpectedMap + installInto: createUnexpectedMap, }; diff --git a/test/assertions/Map.to-be-empty.spec.js b/test/assertions/Map.to-be-empty.spec.js index 1978c18..8da6116 100644 --- a/test/assertions/Map.to-be-empty.spec.js +++ b/test/assertions/Map.to-be-empty.spec.js @@ -9,7 +9,7 @@ describe('to be empty assertion', () => { new Map([ [1, 'foo'], [2, 'bar'], - [3, 'baz'] + [3, 'baz'], ]), 'not to be empty' ); @@ -22,7 +22,7 @@ describe('to be empty assertion', () => { new Map([ [1, 'foo'], [2, 'bar'], - [3, 'baz'] + [3, 'baz'], ]), 'to be empty' ); diff --git a/test/assertions/Map.to-equal.spec.js b/test/assertions/Map.to-equal.spec.js index ada1ef0..382a409 100644 --- a/test/assertions/Map.to-equal.spec.js +++ b/test/assertions/Map.to-equal.spec.js @@ -1,14 +1,14 @@ /* global expect */ -describe('to equal assertion', function() { +describe('to equal assertion', function () { it('should show two maps being equal', () => { - expect(function() { + expect(function () { expect(new Map([['foo', 123]]), 'to equal', new Map([['foo', 123]])); }, 'not to throw'); }); it('should show two maps not being equal (subject)', () => { expect( - function() { + function () { expect(new Map([[{}, 123]]), 'to equal', new Map([[{}, 123]])); }, 'to throw an error satisfying', @@ -26,7 +26,7 @@ describe('to equal assertion', function() { it('should show two maps not being equal (value)', () => { expect( - function() { + function () { expect(new Map([[123, {}]]), 'to equal', new Map([[123, {}]])); }, 'to throw an error satisfying', diff --git a/test/assertions/Map.to-have-values-satisfying.spec.js b/test/assertions/Map.to-have-values-satisfying.spec.js index e5ed51b..d40f3b5 100644 --- a/test/assertions/Map.to-have-values-satisfying.spec.js +++ b/test/assertions/Map.to-have-values-satisfying.spec.js @@ -1,13 +1,13 @@ /* global expect */ -describe('to have values satisfying assertion', function() { - it('should pass with an assertion', function() { - expect(function() { +describe('to have values satisfying assertion', function () { + it('should pass with an assertion', function () { + expect(function () { expect(new Map([[[], null]]), 'to have values satisfying', 'to be null'); }, 'not to error'); }); - it('should pass with an expect.it', function() { - expect(function() { + it('should pass with an expect.it', function () { + expect(function () { expect( new Map([[[], null]]), 'to have values satisfying', @@ -16,21 +16,21 @@ describe('to have values satisfying assertion', function() { }, 'not to error'); }); - it('should pass with an object value and satisfy semantics', function() { - expect(function() { + it('should pass with an object value and satisfy semantics', function () { + expect(function () { expect(new Map([[[], { foo: null }]]), 'to have values satisfying', { - foo: expect.it('to be falsy') + foo: expect.it('to be falsy'), }); }, 'not to error'); }); it('fails if the given Map is empty', () => { expect( - function() { + function () { expect( new Map(), 'to have values satisfying', - expect.it(value => { + expect.it((value) => { expect(value, 'to equal', '0'); }) ); @@ -47,11 +47,11 @@ describe('to have values satisfying assertion', function() { ); }); - it('should render a diff when failing "to have values satisfying"', function() { + it('should render a diff when failing "to have values satisfying"', function () { expect( - function() { + function () { expect(new Map([[[], { foo: null }]]), 'to have values satisfying', { - foo: expect.it('to be a number') + foo: expect.it('to be a number'), }); }, 'to throw an error satisfying', diff --git a/test/assertions/Map.to-satisfy.spec.js b/test/assertions/Map.to-satisfy.spec.js index 9f219e1..6c5a864 100644 --- a/test/assertions/Map.to-satisfy.spec.js +++ b/test/assertions/Map.to-satisfy.spec.js @@ -1,11 +1,11 @@ /* global expect */ -expect.addAssertion(' when delayed a little bit ', function( +expect.addAssertion(' when delayed a little bit ', function ( expect, subject ) { - return expect.promise(function(run) { + return expect.promise(function (run) { setTimeout( - run(function() { + run(function () { return expect.shift(); }), 1 @@ -13,15 +13,15 @@ expect.addAssertion(' when delayed a little bit ', function( }); }); -describe('to satisfy assertion', function() { - it('passes when an object is tested against itself, even in the presence of circular references', function() { +describe('to satisfy assertion', function () { + it('passes when an object is tested against itself, even in the presence of circular references', function () { const circular = {}; circular.loop = circular; expect(circular, 'to satisfy', circular); }); - describe('with the not flag', function() { - it('should succeed when the assertion fails without the not flag', function() { + describe('with the not flag', function () { + it('should succeed when the assertion fails without the not flag', function () { expect( new Map([['foo', 123]]), 'not to satisfy', @@ -29,19 +29,19 @@ describe('to satisfy assertion', function() { ); }); - it('should succeed when the assertion fails without the not flag, async case', function() { + it('should succeed when the assertion fails without the not flag, async case', function () { return expect( new Map([['foo', 123]]), 'not to satisfy', new Map([ - ['foo', expect.it('when delayed a little bit', 'to equal', 456)] + ['foo', expect.it('when delayed a little bit', 'to equal', 456)], ]) ); }); - it('should fail when a non-Unexpected error occurs', function() { + it('should fail when a non-Unexpected error occurs', function () { expect( - function() { + function () { expect( new Map([['foo', 123]]), 'not to satisfy', @@ -55,9 +55,9 @@ describe('to satisfy assertion', function() { ); }); - it('should fail when the assertion succeeds', function() { + it('should fail when the assertion succeeds', function () { expect( - function() { + function () { expect( new Map([['foo', 123]]), 'not to satisfy', @@ -73,7 +73,7 @@ describe('to satisfy assertion', function() { // eslint-disable-next-line no-constant-condition if (false && Object.defineProperty) { - it('should honor the getKeys implementation of a type when building a diff', function() { + it('should honor the getKeys implementation of a type when building a diff', function () { function MyThing(a, b) { this.a = a; Object.defineProperty(this, 'b', { enumerable: false, value: b }); @@ -82,19 +82,19 @@ describe('to satisfy assertion', function() { const clonedExpect = expect.clone().addType({ name: 'MyThing', base: 'object', - identify: function(obj) { + identify: function (obj) { return obj instanceof MyThing; }, - getKeys: function() { + getKeys: function () { return ['a', 'b']; - } + }, }); expect( - function() { + function () { clonedExpect(new MyThing(123, 456), 'to exhaustively satisfy', { a: 123, - b: 654 + b: 654, }); }, 'to throw', @@ -108,16 +108,16 @@ describe('to satisfy assertion', function() { }); } - it('should render a diff where missing properties expected to be missing are not rendered', function() { + it('should render a diff where missing properties expected to be missing are not rendered', function () { // Regression test, used to be shown as: shown as // missing: : undefined expect( - function() { + function () { expect( new Map([['bar', 123]]), 'to satisfy', new Map([ ['foo', undefined], - ['bar', 456] + ['bar', 456], ]) ); }, @@ -135,15 +135,15 @@ describe('to satisfy assertion', function() { ); }); - it('renders missing properties correctly with expect.it', function() { + it('renders missing properties correctly with expect.it', function () { expect( - function() { + function () { expect( new Map([['foo', 'bar']]), 'to satisfy', new Map([ ['foo', 'bar'], - ['baz', expect.it('to equal', 123)] + ['baz', expect.it('to equal', 123)], ]) ); }, @@ -161,8 +161,8 @@ describe('to satisfy assertion', function() { ); }); - describe('with a synchronous expect.it in the RHS object', function() { - it('should support an object with a property value of expect.it', function() { + describe('with a synchronous expect.it in the RHS object', function () { + it('should support an object with a property value of expect.it', function () { expect( new Map([['foo', 'bar']]), 'to satisfy', @@ -170,25 +170,25 @@ describe('to satisfy assertion', function() { ); }); - it('should support passing an array value to an expect.it', function() { + it('should support passing an array value to an expect.it', function () { expect( new Map([['foo', [123]]]), 'to satisfy', new Map([ - ['foo', expect.it('to have items satisfying', 'to be a number')] + ['foo', expect.it('to have items satisfying', 'to be a number')], ]) ); }); - it('should not call functions in the LHS object', function() { + it('should not call functions in the LHS object', function () { expect( new Map([ [ 'foo', - function() { + function () { throw new Error('Explosion'); - } - ] + }, + ], ]), 'to satisfy', new Map([['foo', expect.it('to be a function')]]) @@ -196,18 +196,18 @@ describe('to satisfy assertion', function() { }); }); - describe('with an asynchronous expect.it in the RHS object', function() { - it('should support an object with a property value of expect.it', function() { + describe('with an asynchronous expect.it in the RHS object', function () { + it('should support an object with a property value of expect.it', function () { return expect( new Map([['foo', 'bar']]), 'to satisfy', new Map([ - ['foo', expect.it('when delayed a little bit', 'to be a string')] + ['foo', expect.it('when delayed a little bit', 'to be a string')], ]) ); }); - it('should support passing an array value to an expect.it', function() { + it('should support passing an array value to an expect.it', function () { return expect( new Map([['foo', [123]]]), 'to satisfy', @@ -218,18 +218,18 @@ describe('to satisfy assertion', function() { 'when delayed a little bit', 'to have items satisfying', 'to be a number' - ) - ] + ), + ], ]) ); }); }); - it('should support regular expressions in the RHS object', function() { + it('should support regular expressions in the RHS object', function () { expect(new Map([['foo', 'bar']]), 'to satisfy', new Map([['foo', /ba/]])); expect( - function() { + function () { expect( new Map([['foo', 'foo']]), 'to satisfy', @@ -250,7 +250,7 @@ describe('to satisfy assertion', function() { ); expect( - function() { + function () { expect( new Map([['foo', 'foo']]), 'to satisfy', @@ -275,7 +275,7 @@ describe('to satisfy assertion', function() { ); }); - it('should support expect.it in an array', function() { + it('should support expect.it in an array', function () { expect( new Map([['foo', 123]]), 'to satisfy', @@ -283,23 +283,23 @@ describe('to satisfy assertion', function() { ); }); - describe('with a regular function in the RHS object', function() { - it('should throw an exception if the condition is not met', function() { + describe('with a regular function in the RHS object', function () { + it('should throw an exception if the condition is not met', function () { expect( new Map([['foo', 123]]), 'to satisfy', - expect.it(obj => { + expect.it((obj) => { expect(obj.get('foo'), 'to equal', 123); }) ); }); - it('should only consider functions that are identified as functions by the type system', function() { + it('should only consider functions that are identified as functions by the type system', function () { const clonedExpect = expect.clone().addType({ name: 'functionStartingWithF', - identify: function(obj) { + identify: function (obj) { return typeof obj === 'function' && /^f/i.test(obj.name); - } + }, }); function foo() { @@ -315,22 +315,22 @@ describe('to satisfy assertion', function() { }); }); - it('should support a chained expect.it', function() { + it('should support a chained expect.it', function () { expect( new Map([['foo', 123]]), 'to satisfy', new Map([ - ['foo', expect.it('to be a number').and('to be greater than', 10)] + ['foo', expect.it('to be a number').and('to be greater than', 10)], ]) ); expect( - function() { + function () { expect( new Map([['foo', 123]]), 'to satisfy', new Map([ - ['foo', expect.it('to be a number').and('to be greater than', 200)] + ['foo', expect.it('to be a number').and('to be greater than', 200)], ]) ); }, @@ -353,7 +353,7 @@ describe('to satisfy assertion', function() { ); }); - it('should support asserting on properties that are not defined', function() { + it('should support asserting on properties that are not defined', function () { expect( new Map([['foo', 123]]), 'to satisfy', @@ -361,7 +361,7 @@ describe('to satisfy assertion', function() { ); }); - it('should assert missing properties with undefined in the RHS object', function() { + it('should assert missing properties with undefined in the RHS object', function () { expect( new Map([['foo', 123]]), 'to satisfy', @@ -369,7 +369,7 @@ describe('to satisfy assertion', function() { ); }); - it('should support the exhaustively flag', function() { + it('should support the exhaustively flag', function () { expect( new Map([['foo', 123]]), 'to exhaustively satisfy', @@ -377,43 +377,43 @@ describe('to satisfy assertion', function() { ); }); - it('should support delegating to itself with the exhaustively flag', function() { + it('should support delegating to itself with the exhaustively flag', function () { expect( new Map([ ['foo', new Map([['bar', 123]])], - ['baz', 456] + ['baz', 456], ]), 'to satisfy', new Map([ - ['foo', expect.it('to exhaustively satisfy', new Map([['bar', 123]]))] + ['foo', expect.it('to exhaustively satisfy', new Map([['bar', 123]]))], ]) ); }); - it('should support delegating to itself without the exhaustively flag', function() { + it('should support delegating to itself without the exhaustively flag', function () { expect( new Map([ [ 'foo', new Map([ ['bar', 123], - ['baz', 456] - ]) + ['baz', 456], + ]), ], - ['baz', 456] + ['baz', 456], ]), 'to satisfy', new Map([['foo', expect.it('to satisfy', new Map([['bar', 123]]))]]) ); }); - it('should not fail when matching an object against a number', function() { + it('should not fail when matching an object against a number', function () { expect(new Map([['foo', {}]]), 'not to satisfy', new Map([['foo', 123]])); }); - it('fails when using an unknown assertion', function() { + it('fails when using an unknown assertion', function () { expect( - function() { + function () { expect( new Map([['bool', 'true']]), 'to satisfy', @@ -439,23 +439,23 @@ describe('to satisfy assertion', function() { ); }); - it.skip('collapses subtrees without conflicts', function() { + it.skip('collapses subtrees without conflicts', function () { expect( - function() { + function () { expect( { pill: { red: "I'll show you how deep the rabbit hole goes", blue: { ignorance: { - of: { illusion: { will: { not: { lead: 'to the truth' } } } } - } + of: { illusion: { will: { not: { lead: 'to the truth' } } } }, + }, }, purple: { you: 'wat there is another pill', - them: 'there is always more choices' - } - } + them: 'there is always more choices', + }, + }, }, 'to satisfy', { @@ -463,10 +463,10 @@ describe('to satisfy assertion', function() { red: "I'll show you how deep the rabbit hole goes.", blue: { ignorance: { - of: { illusion: { will: { not: { lead: 'to the truth' } } } } - } - } - } + of: { illusion: { will: { not: { lead: 'to the truth' } } } }, + }, + }, + }, } ); }, @@ -501,10 +501,10 @@ describe('to satisfy assertion', function() { ); }); - it.skip('indents removed objects correctly', function() { + it.skip('indents removed objects correctly', function () { const str = 'abcdefghijklmnopqrstuvwxyz'; expect( - function() { + function () { expect( { foo: { a: str, b: str, c: str, d: str, e: str } }, 'to equal', @@ -536,10 +536,10 @@ describe('to satisfy assertion', function() { ); }); - it.skip('indents unchanged objects correctly', function() { + it.skip('indents unchanged objects correctly', function () { const str = 'abcdefghijklmnopqrstuvwxyz'; expect( - function() { + function () { expect( { foo: { a: str, b: str, c: str, d: str, e: str }, bar: 1 }, 'to equal', @@ -582,13 +582,13 @@ describe('to satisfy assertion', function() { ); }); - it.skip('can be negated with the "not" flag', function() { + it.skip('can be negated with the "not" flag', function () { expect(123, 'not to satisfy assertion', 'to be a string'); expect('foobar', 'not to satisfy', /quux/i); expect({ foo: 123 }, 'not to satisfy', { - foo: expect.it('to be a string') + foo: expect.it('to be a string'), }); expect({ foo: 123, bar: 456 }, 'not to exhaustively satisfy', { foo: 123 }); @@ -616,7 +616,7 @@ describe('to satisfy assertion', function() { expect( new Map([ ['foo', true], - ['bar', false] + ['bar', false], ]), 'to exhaustively satisfy', new Map() @@ -637,10 +637,10 @@ describe('to satisfy assertion', function() { }); }); - describe('when an unpresent value to is satisfied against an expect.it function wrapper', function() { - it('should fail when the function throws', function() { + describe('when an unpresent value to is satisfied against an expect.it function wrapper', function () { + it('should fail when the function throws', function () { expect( - function() { + function () { expect( new Map(), 'to satisfy', @@ -660,8 +660,8 @@ describe('to satisfy assertion', function() { }); }); - describe('when an unpresent value to is satisfied against an expect.it', function() { - it('should succeed', function() { + describe('when an unpresent value to is satisfied against an expect.it', function () { + it('should succeed', function () { expect( new Map([]), 'to satisfy', @@ -669,9 +669,9 @@ describe('to satisfy assertion', function() { ); }); - it('should fail with a diff', function() { + it('should fail with a diff', function () { expect( - function() { + function () { expect( new Map([]), 'to satisfy', @@ -691,9 +691,9 @@ describe('to satisfy assertion', function() { }); }); - it('should not break when the assertion fails and there is a fulfilled, expect.it-wrapped function in the RHS', function() { + it('should not break when the assertion fails and there is a fulfilled, expect.it-wrapped function in the RHS', function () { expect( - function() { + function () { expect( new Map([]), 'to satisfy', @@ -701,15 +701,15 @@ describe('to satisfy assertion', function() { ['bar', 123], [ 'foo', - expect.it(function(v) { + expect.it(function (v) { expect(v, 'to be undefined'); - }) - ] + }), + ], ]) ); }, 'to throw', - expect.it(function(err) { + expect.it(function (err) { // Compensate for V8 5.1+ setting { foo: function () {} }.foo.name === 'foo' // http://v8project.blogspot.dk/2016/04/v8-release-51.html expect( @@ -762,9 +762,9 @@ describe('to satisfy assertion', function() { ); }); - it('should not break when the assertion fails and the subject has a property that also exists on Object.prototype', function() { + it('should not break when the assertion fails and the subject has a property that also exists on Object.prototype', function () { expect( - function() { + function () { expect( new Map([['constructor', 123]]), 'to satisfy', diff --git a/test/common/node.js b/test/common/node.js index c5d5169..f8af4a6 100644 --- a/test/common/node.js +++ b/test/common/node.js @@ -9,7 +9,7 @@ expect.output.preferredWidth = 80; expect.addAssertion( ' to throw an error satisfying ', (expect, cb) => - expect(cb, 'to throw').then(err => { + expect(cb, 'to throw').then((err) => { expect.errorMode = 'nested'; return expect.shift( err.isUnexpected ? err.getErrorMessage('text').toString() : err.message @@ -17,7 +17,7 @@ expect.addAssertion( }) ); -(function(root) { +(function (root) { // expose globals root.expect = expect; })(typeof window !== 'undefined' ? window : global); diff --git a/test/types/Map-type.spec.js b/test/types/Map-type.spec.js index 20866d0..866aadb 100644 --- a/test/types/Map-type.spec.js +++ b/test/types/Map-type.spec.js @@ -1,22 +1,22 @@ /* global expect */ -(typeof Map !== 'function' ? describe.skip : describe)('Map type', function() { - it('treats an empty Map as equal to Map', function() { +(typeof Map !== 'function' ? describe.skip : describe)('Map type', function () { + it('treats an empty Map as equal to Map', function () { expect(new Map(), 'to equal', new Map()); }); - it('treats an matching Maps as equal', function() { + it('treats an matching Maps as equal', function () { expect(new Map([['foo', 'bar']]), 'to equal', new Map([['foo', 'bar']])); }); - it('should mark missing Map keys', function() { + it('should mark missing Map keys', function () { expect( - function() { + function () { expect( new Map([['quux', 'bar']]), 'to equal', new Map([ ['quux', 'bar'], - ['zuuq', 'baz'] + ['zuuq', 'baz'], ]) ); }, @@ -34,13 +34,13 @@ ); }); - it('should mark unecessary Map keys', function() { + it('should mark unecessary Map keys', function () { expect( - function() { + function () { expect( new Map([ ['quux', 'bar'], - ['zuuq', 'baz'] + ['zuuq', 'baz'], ]), 'to equal', new Map([['quux', 'bar']]) @@ -60,9 +60,9 @@ ); }); - it('should output a value diff on matching Map', function() { + it('should output a value diff on matching Map', function () { expect( - function() { + function () { expect( new Map([['foo', 'bar']]), 'to equal', @@ -86,9 +86,9 @@ ); }); - it('should output a diff for complex Map keys', function() { + it('should output a diff for complex Map keys', function () { expect( - function() { + function () { expect( new Map([[['a', 'b'], 'bar']]), 'to equal', @@ -108,8 +108,8 @@ ); }); - it('should satisfy a Map', function() { - expect(function() { + it('should satisfy a Map', function () { + expect(function () { const key = []; expect( @@ -120,17 +120,17 @@ }, 'not to error'); }); - it('should output a diff on mistatching key in "to satisfy"', function() { + it('should output a diff on mistatching key in "to satisfy"', function () { const arrayKey = []; expect( - function() { + function () { expect( new Map([[arrayKey, { foo: null }]]), 'to satisfy', new Map([ [arrayKey, { foo: null }], - ['bar', 'baz'] + ['bar', 'baz'], ]) ); }, @@ -148,9 +148,9 @@ ); }); - it('should output a diff when failing "to satisfy"', function() { + it('should output a diff when failing "to satisfy"', function () { expect( - function() { + function () { expect( new Map([['foo', { foo: null }]]), 'to satisfy',