From 1660015c12022cfcb5757c68cbe8d7296239cdde Mon Sep 17 00:00:00 2001 From: Nito Buendia Date: Wed, 16 Mar 2022 23:01:20 +0800 Subject: [PATCH] Run formatter --- .../matchers/toHaveSpyInteractionsSpec.js | 53 +++++++++++-------- src/core/matchers/toHaveSpyInteractions.js | 4 +- 2 files changed, 33 insertions(+), 24 deletions(-) diff --git a/spec/core/matchers/toHaveSpyInteractionsSpec.js b/spec/core/matchers/toHaveSpyInteractionsSpec.js index 3720adb8..80d4b700 100755 --- a/spec/core/matchers/toHaveSpyInteractionsSpec.js +++ b/spec/core/matchers/toHaveSpyInteractionsSpec.js @@ -1,8 +1,9 @@ -describe('toHaveSpyInteractions', function () { - - it('detects spy interactions', function () { +describe('toHaveSpyInteractions', function() { + it('detects spy interactions', function() { let matcher = jasmineUnderTest.matchers.toHaveSpyInteractions(); - let spyObj = jasmineUnderTest.getEnv().createSpyObj('NewClass', ['spyA', 'spyB']); + let spyObj = jasmineUnderTest + .getEnv() + .createSpyObj('NewClass', ['spyA', 'spyB']); spyObj.spyA(); @@ -13,9 +14,11 @@ describe('toHaveSpyInteractions', function () { ); }); - it('detects multiple spy interactions', function () { + it('detects multiple spy interactions', function() { let matcher = jasmineUnderTest.matchers.toHaveSpyInteractions(); - let spyObj = jasmineUnderTest.getEnv().createSpyObj('NewClass', ['spyA', 'spyB']); + let spyObj = jasmineUnderTest + .getEnv() + .createSpyObj('NewClass', ['spyA', 'spyB']); spyObj.spyA(); spyObj.spyB(); @@ -28,9 +31,11 @@ describe('toHaveSpyInteractions', function () { ); }); - it('detects no spy interactions', function () { + it('detects no spy interactions', function() { let matcher = jasmineUnderTest.matchers.toHaveSpyInteractions(); - let spyObj = jasmineUnderTest.getEnv().createSpyObj('NewClass', ['spyA', 'spyB']); + let spyObj = jasmineUnderTest + .getEnv() + .createSpyObj('NewClass', ['spyA', 'spyB']); let result = matcher.compare(spyObj); expect(result.pass).toBe(false); @@ -39,10 +44,12 @@ describe('toHaveSpyInteractions', function () { ); }); - it('ignores non-observed spy object interactions', function () { + it('ignores non-observed spy object interactions', function() { let matcher = jasmineUnderTest.matchers.toHaveSpyInteractions(); - let spyObj = jasmineUnderTest.getEnv().createSpyObj('NewClass', ['spyA', 'spyB']); - spyObj.otherMethod = function () { }; + let spyObj = jasmineUnderTest + .getEnv() + .createSpyObj('NewClass', ['spyA', 'spyB']); + spyObj.otherMethod = function() {}; spyObj.otherMethod(); @@ -53,32 +60,36 @@ describe('toHaveSpyInteractions', function () { ); }); - [true, 123, 'string'].forEach(function (testValue) { - it(`throws error if a non-object (${testValue}) is passed`, function () { + [true, 123, 'string'].forEach(function(testValue) { + it(`throws error if a non-object (${testValue}) is passed`, function() { let matcher = jasmineUnderTest.matchers.toHaveSpyInteractions(); - expect(function () { + expect(function() { matcher.compare(testValue); }).toThrowError(Error, /Expected a spy object, but got/); }); }); - it('throws error if arguments are passed', function () { + it('throws error if arguments are passed', function() { let matcher = jasmineUnderTest.matchers.toHaveSpyInteractions(); - let spyObj = jasmineUnderTest.getEnv().createSpyObj('NewClass', ['spyA', 'spyB']); + let spyObj = jasmineUnderTest + .getEnv() + .createSpyObj('NewClass', ['spyA', 'spyB']); - expect(function () { + expect(function() { matcher.compare(spyObj, 'an argument'); }).toThrowError(Error, /Does not take arguments/); }); - it('throws error if spy object has no spies', function () { + it('throws error if spy object has no spies', function() { let matcher = jasmineUnderTest.matchers.toHaveSpyInteractions(); - const spyObj = jasmineUnderTest.getEnv().createSpyObj('NewClass', ['notSpy']); + const spyObj = jasmineUnderTest + .getEnv() + .createSpyObj('NewClass', ['notSpy']); // Removing spy since spy objects cannot be created without spies. - spyObj.notSpy = function () { }; + spyObj.notSpy = function() {}; - expect(function () { + expect(function() { matcher.compare(spyObj); }).toThrowError( Error, diff --git a/src/core/matchers/toHaveSpyInteractions.js b/src/core/matchers/toHaveSpyInteractions.js index a6a5fdc9..58f6d44d 100755 --- a/src/core/matchers/toHaveSpyInteractions.js +++ b/src/core/matchers/toHaveSpyInteractions.js @@ -19,9 +19,7 @@ getJasmineRequireObj().toHaveSpyInteractions = function(j$) { if (!j$.isObject_(actual)) { throw new Error( - getErrorMsg( - 'Expected a spy object, but got ' + typeof actual + '.' - ) + getErrorMsg('Expected a spy object, but got ' + typeof actual + '.') ); }