From 2e8b4774890864aa8328471ec46b62580901238e Mon Sep 17 00:00:00 2001 From: Nito Buendia Date: Wed, 16 Mar 2022 21:14:43 +0800 Subject: [PATCH] Change arrow functions with anonymous functions --- .../matchers/toHaveSpyInteractionsSpec.js | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/spec/core/matchers/toHaveSpyInteractionsSpec.js b/spec/core/matchers/toHaveSpyInteractionsSpec.js index 98f8c270..4092719a 100755 --- a/spec/core/matchers/toHaveSpyInteractionsSpec.js +++ b/spec/core/matchers/toHaveSpyInteractionsSpec.js @@ -1,53 +1,53 @@ -describe('toHaveSpyInteractions', () => { +describe('toHaveSpyInteractions', function() { let spyObj; - beforeEach(() => { - spyObj = jasmineUnderTest.createSpyObj('NewClass', ['spyA', 'spyB']); + beforeEach(function() { + spyObj = jasmine.createSpyObj('NewClass', ['spyA', 'spyB']); spyObj.otherMethod = function() {}; }); - it('detects spy interactions', () => { + it('detects spy interactions', function() { spyObj.spyA(); expect(spyObj).toHaveSpyInteractions(); }); - it('detects multiple spy interactions', () => { + it('detects multiple spy interactions', function() { spyObj.spyA(); spyObj.spyB(); spyObj.spyA(); expect(spyObj).toHaveSpyInteractions(); }); - it('detects no spy interactions', () => { + it('detects no spy interactions', function() { expect(spyObj).not.toHaveSpyInteractions(); }); - it('ignores non-observed spy object interactions', () => { + it('ignores non-observed spy object interactions', function() { spyObj.otherMethod(); expect(spyObj).not.toHaveSpyInteractions(); }); - [true, 123, 'string'].forEach(testValue => { - it(`throws error if a non-object (${testValue}) is passed`, () => { - expect(() => { + [true, 123, 'string'].forEach(function(testValue) { + it(`throws error if a non-object (${testValue}) is passed`, function() { + expect(function() { expect(true).toHaveSpyInteractions(); }).toThrowError(Error, /Expected a spy object, but got/); }); }); - [['argument'], [false, 0]].forEach(testValue => { - it(`throws error if arguments (${testValue}) are passed`, () => { - expect(() => { + [['argument'], [false, 0]].forEach(function(testValue) { + it(`throws error if arguments (${testValue}) are passed`, function() { + expect(function() { expect(spyObj).toHaveSpyInteractions(...testValue); }).toThrowError(Error, /Does not take arguments/); }); }); - it('throws error if spy object has no spies', () => { + it('throws error if spy object has no spies', function() { const newSpyObj = jasmine.createSpyObj('OtherClass', ['method']); // Removing spy since spy objects cannot be created without spies. newSpyObj.method = function() {}; - expect(() => { + expect(function() { expect(newSpyObj).toHaveSpyInteractions(); }).toThrowError( Error,