Skip to content

Commit 95f0ab9

Browse files
committed
style: fix eslint errors
1 parent 26b5ddb commit 95f0ab9

1 file changed

Lines changed: 27 additions & 27 deletions

File tree

packages/jest-mock/src/__tests__/jest_mock.test.js

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('moduleMocker', () => {
2121

2222
describe('getMetadata', () => {
2323
it('returns the function `name` property', () => {
24-
function x() { }
24+
function x() {}
2525
const metadata = moduleMocker.getMetadata(x);
2626
expect(x.name).toBe('x');
2727
expect(metadata.name).toBe('x');
@@ -60,7 +60,7 @@ describe('moduleMocker', () => {
6060

6161
describe('generateFromMetadata', () => {
6262
it('forwards the function name property', () => {
63-
function foo() { }
63+
function foo() {}
6464
const mock = moduleMocker.generateFromMetadata(
6565
moduleMocker.getMetadata(foo),
6666
);
@@ -69,8 +69,8 @@ describe('moduleMocker', () => {
6969

7070
it('escapes illegal characters in function name property', () => {
7171
function getMockFnWithOriginalName(name) {
72-
const fn = () => { };
73-
Object.defineProperty(fn, 'name', { value: name });
72+
const fn = () => {};
73+
Object.defineProperty(fn, 'name', {value: name});
7474

7575
return moduleMocker.generateFromMetadata(moduleMocker.getMetadata(fn));
7676
}
@@ -93,7 +93,7 @@ describe('moduleMocker', () => {
9393
});
9494

9595
it('special cases the mockConstructor name', () => {
96-
function mockConstructor() { }
96+
function mockConstructor() {}
9797
const mock = moduleMocker.generateFromMetadata(
9898
moduleMocker.getMetadata(mockConstructor),
9999
);
@@ -102,8 +102,8 @@ describe('moduleMocker', () => {
102102
});
103103

104104
it('wont interfere with previous mocks on a shared prototype', () => {
105-
const ClassFoo = function () { };
106-
ClassFoo.prototype.x = () => { };
105+
const ClassFoo = function() {};
106+
ClassFoo.prototype.x = () => {};
107107
const ClassFooMock = moduleMocker.generateFromMetadata(
108108
moduleMocker.getMetadata(ClassFoo),
109109
);
@@ -131,7 +131,7 @@ describe('moduleMocker', () => {
131131
},
132132
},
133133
nonEnumMethod: {
134-
value: () => { },
134+
value: () => {},
135135
},
136136
},
137137
);
@@ -166,7 +166,7 @@ describe('moduleMocker', () => {
166166

167167
it('mocks ES2015 non-enumerable methods', () => {
168168
class ClassFoo {
169-
foo() { }
169+
foo() {}
170170
toString() {
171171
return 'Foo';
172172
}
@@ -190,7 +190,7 @@ describe('moduleMocker', () => {
190190
});
191191

192192
it('mocks methods that are bound multiple times', () => {
193-
const func = function func() { };
193+
const func = function func() {};
194194
const multipleBoundFunc = func.bind(null).bind(null);
195195

196196
const multipleBoundFuncMock = moduleMocker.generateFromMetadata(
@@ -202,7 +202,7 @@ describe('moduleMocker', () => {
202202

203203
it('mocks methods that are bound after mocking', () => {
204204
const fooMock = moduleMocker.generateFromMetadata(
205-
moduleMocker.getMetadata(() => { }),
205+
moduleMocker.getMetadata(() => {}),
206206
);
207207

208208
const barMock = moduleMocker.generateFromMetadata(
@@ -475,13 +475,13 @@ describe('moduleMocker', () => {
475475
it('should mock constructor', () => {
476476
const mock1 = jest.fn();
477477
const mock2 = jest.fn();
478-
const Module = jest.fn(() => ({ someFn: mock1 }));
479-
const testFn = function () {
478+
const Module = jest.fn(() => ({someFn: mock1}));
479+
const testFn = function() {
480480
const m = new Module();
481481
m.someFn();
482482
};
483483

484-
Module.mockImplementationOnce(() => ({ someFn: mock2 }));
484+
Module.mockImplementationOnce(() => ({someFn: mock2}));
485485

486486
testFn();
487487
expect(mock2).toHaveBeenCalled();
@@ -538,7 +538,7 @@ describe('moduleMocker', () => {
538538
it('should recognize a mocked function', () => {
539539
const mockFn = moduleMocker.fn();
540540

541-
expect(moduleMocker.isMockFunction(() => { })).toBe(false);
541+
expect(moduleMocker.isMockFunction(() => {})).toBe(false);
542542
expect(moduleMocker.isMockFunction(mockFn)).toBe(true);
543543
});
544544

@@ -593,9 +593,9 @@ describe('moduleMocker', () => {
593593

594594
const spy = moduleMocker.spyOn(obj, 'method');
595595

596-
const thisArg = { this: true };
597-
const firstArg = { first: true };
598-
const secondArg = { second: true };
596+
const thisArg = {this: true};
597+
const firstArg = {first: true};
598+
const secondArg = {second: true};
599599
obj.method.call(thisArg, firstArg, secondArg);
600600
expect(isOriginalCalled).toBe(true);
601601
expect(originalCallThis).toBe(thisArg);
@@ -626,7 +626,7 @@ describe('moduleMocker', () => {
626626
moduleMocker.spyOn({}, 'method');
627627
}).toThrow();
628628
expect(() => {
629-
moduleMocker.spyOn({ method: 10 }, 'method');
629+
moduleMocker.spyOn({method: 10}, 'method');
630630
}).toThrow();
631631
});
632632

@@ -674,7 +674,7 @@ describe('moduleMocker', () => {
674674
let originalCallArguments;
675675
const obj = {
676676
get method() {
677-
return function () {
677+
return function() {
678678
isOriginalCalled = true;
679679
originalCallThis = this;
680680
originalCallArguments = arguments;
@@ -684,9 +684,9 @@ describe('moduleMocker', () => {
684684

685685
const spy = moduleMocker.spyOn(obj, 'method', 'get');
686686

687-
const thisArg = { this: true };
688-
const firstArg = { first: true };
689-
const secondArg = { second: true };
687+
const thisArg = {this: true};
688+
const firstArg = {first: true};
689+
const secondArg = {second: true};
690690
obj.method.call(thisArg, firstArg, secondArg);
691691
expect(isOriginalCalled).toBe(true);
692692
expect(originalCallThis).toBe(thisArg);
@@ -717,7 +717,7 @@ describe('moduleMocker', () => {
717717
},
718718
get property() {
719719
return this._property;
720-
}
720+
},
721721
};
722722

723723
const spy = moduleMocker.spyOn(obj, 'property', 'set');
@@ -740,7 +740,7 @@ describe('moduleMocker', () => {
740740
moduleMocker.spyOn({}, 'method');
741741
}).toThrow();
742742
expect(() => {
743-
moduleMocker.spyOn({ method: 10 }, 'method');
743+
moduleMocker.spyOn({method: 10}, 'method');
744744
}).toThrow();
745745
});
746746

@@ -749,12 +749,12 @@ describe('moduleMocker', () => {
749749
let methodTwoCalls = 0;
750750
const obj = {
751751
get methodOne() {
752-
return function () {
752+
return function() {
753753
methodOneCalls++;
754754
};
755755
},
756756
get methodTwo() {
757-
return function () {
757+
return function() {
758758
methodTwoCalls++;
759759
};
760760
},

0 commit comments

Comments
 (0)