Skip to content
This repository was archived by the owner on Nov 27, 2024. It is now read-only.

Commit 3a3b089

Browse files
committed
upgrade prettier
1 parent c04bdd7 commit 3a3b089

File tree

6 files changed

+75
-75
lines changed

6 files changed

+75
-75
lines changed

__tests__/jest-built-ins.spec.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ describe('jest built-ins', () => {
77
fetch.mock('http://example.com', 200).mock('http://example2.com', 201);
88
fetch('http://example.com', {
99
headers: {
10-
test: 'header'
11-
}
10+
test: 'header',
11+
},
1212
});
1313
fetch('http://example2.com', {
1414
headers: {
15-
test: 'header2'
16-
}
15+
test: 'header2',
16+
},
1717
});
1818
});
1919

@@ -26,28 +26,28 @@ describe('jest built-ins', () => {
2626
'http://example.com',
2727
{
2828
headers: {
29-
test: 'header'
30-
}
31-
}
29+
test: 'header',
30+
},
31+
},
3232
],
3333
[
3434
'http://example2.com',
3535
{
3636
headers: {
37-
test: 'header2'
38-
}
39-
}
40-
]
37+
test: 'header2',
38+
},
39+
},
40+
],
4141
]);
4242
});
4343
it('exposes `results` property', async () => {
4444
expect(fetch.mock.results).toBeDefined();
4545
expect(fetch.mock.results.length).toEqual(2);
4646
expect(await fetch.mock.results[0].value).toMatchObject({
47-
status: 200
47+
status: 200,
4848
});
4949
expect(await fetch.mock.results[1].value).toMatchObject({
50-
status: 201
50+
status: 201,
5151
});
5252
});
5353
});
@@ -57,13 +57,13 @@ describe('jest built-ins', () => {
5757
fetch.mock('http://example.com', 200).mock('http://example2.com', 201);
5858
fetch('http://example.com', {
5959
headers: {
60-
test: 'header'
61-
}
60+
test: 'header',
61+
},
6262
});
6363
fetch('http://example2.com', {
6464
headers: {
65-
test: 'header2'
66-
}
65+
test: 'header2',
66+
},
6767
});
6868
});
6969

__tests__/jest-extensions.spec.js

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ describe('jest extensions', () => {
3333
fetch.mock('*', 200);
3434
fetch('http://example.com/path2', {
3535
headers: {
36-
test: 'header'
37-
}
36+
test: 'header',
37+
},
3838
});
3939
fetch('http://example.com/path', {
4040
headers: {
41-
test: 'header'
42-
}
41+
test: 'header',
42+
},
4343
});
4444
});
4545
afterAll(() => fetch.reset());
@@ -55,24 +55,24 @@ describe('jest extensions', () => {
5555
it('matches with matcher and options', () => {
5656
expect(fetch).toHaveFetched('http://example.com/path', {
5757
headers: {
58-
test: 'header'
59-
}
58+
test: 'header',
59+
},
6060
});
6161
});
6262

6363
it("doesn't match if matcher but not options is correct", () => {
6464
expect(fetch).not.toHaveFetched('http://example.com/path', {
6565
headers: {
66-
test: 'not-header'
67-
}
66+
test: 'not-header',
67+
},
6868
});
6969
});
7070

7171
it("doesn't match if options but not matcher is correct", () => {
7272
expect(fetch).not.toHaveFetched('http://example-no.com/path', {
7373
headers: {
74-
test: 'header'
75-
}
74+
test: 'header',
75+
},
7676
});
7777
});
7878
});
@@ -81,8 +81,8 @@ describe('jest extensions', () => {
8181
fetch.mock('*', 200);
8282
fetch('http://example.com/path', {
8383
headers: {
84-
test: 'header'
85-
}
84+
test: 'header',
85+
},
8686
});
8787
});
8888
afterAll(() => fetch.reset());
@@ -98,24 +98,24 @@ describe('jest extensions', () => {
9898
it('matches with matcher and options', () => {
9999
expect(fetch).toHaveLastFetched('http://example.com/path', {
100100
headers: {
101-
test: 'header'
102-
}
101+
test: 'header',
102+
},
103103
});
104104
});
105105

106106
it("doesn't match if matcher but not options is correct", () => {
107107
expect(fetch).not.toHaveLastFetched('http://example.com/path', {
108108
headers: {
109-
test: 'not-header'
110-
}
109+
test: 'not-header',
110+
},
111111
});
112112
});
113113

114114
it("doesn't match if options but not matcher is correct", () => {
115115
expect(fetch).not.toHaveLastFetched('http://example-no.com/path', {
116116
headers: {
117-
test: 'header'
118-
}
117+
test: 'header',
118+
},
119119
});
120120
});
121121
});
@@ -125,13 +125,13 @@ describe('jest extensions', () => {
125125
fetch.mock('*', 200);
126126
fetch('http://example1.com/path', {
127127
headers: {
128-
test: 'header'
129-
}
128+
test: 'header',
129+
},
130130
});
131131
fetch('http://example2.com/path', {
132132
headers: {
133-
test: 'header'
134-
}
133+
test: 'header',
134+
},
135135
});
136136
});
137137
afterAll(() => fetch.reset());
@@ -147,24 +147,24 @@ describe('jest extensions', () => {
147147
it('matches with matcher and options', () => {
148148
expect(fetch).toHaveNthFetched(2, 'http://example2.com/path', {
149149
headers: {
150-
test: 'header'
151-
}
150+
test: 'header',
151+
},
152152
});
153153
});
154154

155155
it("doesn't match if matcher but not options is correct", () => {
156156
expect(fetch).not.toHaveNthFetched(2, 'http://example2.com/path', {
157157
headers: {
158-
test: 'not-header'
159-
}
158+
test: 'not-header',
159+
},
160160
});
161161
});
162162

163163
it("doesn't match if options but not matcher is correct", () => {
164164
expect(fetch).not.toHaveNthFetched(2, 'http://example-no.com/path', {
165165
headers: {
166-
test: 'header'
167-
}
166+
test: 'header',
167+
},
168168
});
169169
});
170170

@@ -178,13 +178,13 @@ describe('jest extensions', () => {
178178
fetch.mock('*', 200);
179179
fetch('http://example.com/path', {
180180
headers: {
181-
test: 'header'
182-
}
181+
test: 'header',
182+
},
183183
});
184184
fetch('http://example.com/path', {
185185
headers: {
186-
test: 'header'
187-
}
186+
test: 'header',
187+
},
188188
});
189189
});
190190
afterAll(() => fetch.reset());
@@ -200,24 +200,24 @@ describe('jest extensions', () => {
200200
it('matches with matcher and options', () => {
201201
expect(fetch).toHaveFetchedTimes(2, 'http://example.com/path', {
202202
headers: {
203-
test: 'header'
204-
}
203+
test: 'header',
204+
},
205205
});
206206
});
207207

208208
it("doesn't match if matcher but not options is correct", () => {
209209
expect(fetch).not.toHaveFetchedTimes(2, 'http://example.com/path', {
210210
headers: {
211-
test: 'not-header'
212-
}
211+
test: 'not-header',
212+
},
213213
});
214214
});
215215

216216
it("doesn't match if options but not matcher is correct", () => {
217217
expect(fetch).not.toHaveFetchedTimes(2, 'http://example-no.com/path', {
218218
headers: {
219-
test: 'header'
220-
}
219+
test: 'header',
220+
},
221221
});
222222
});
223223

@@ -236,13 +236,13 @@ describe('jest extensions', () => {
236236
fetch.mock('http://example2.com/path', 200, { repeat: 2 });
237237
fetch('http://example.com/path', {
238238
headers: {
239-
test: 'header'
240-
}
239+
test: 'header',
240+
},
241241
});
242242
fetch('http://example2.com/path', {
243243
headers: {
244-
test: 'header'
245-
}
244+
test: 'header',
245+
},
246246
});
247247
});
248248
afterAll(() => fetch.reset());

jest-extensions.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ expect.extend({
55
}
66
return {
77
pass: false,
8-
message: () => `fetch should have been called with ${url}`
8+
message: () => `fetch should have been called with ${url}`,
99
};
1010
},
1111
toHaveLastFetched: (fetchMock, url, options) => {
1212
const allCalls = fetchMock.calls();
1313
if (!allCalls.length) {
1414
return {
1515
pass: false,
16-
message: () => `No calls made to fetch`
16+
message: () => `No calls made to fetch`,
1717
};
1818
}
1919
const lastCall = [...allCalls].pop();
@@ -24,7 +24,7 @@ expect.extend({
2424
return {
2525
pass: false,
2626
message: () =>
27-
`Last call to fetch should have had a URL of ${url} but was ${lastCall.url}`
27+
`Last call to fetch should have had a URL of ${url} but was ${lastCall.url}`,
2828
};
2929
},
3030

@@ -37,7 +37,7 @@ expect.extend({
3737
return {
3838
pass: false,
3939
message: () =>
40-
`${n}th call to fetch should have had a URL of ${url} but was ${nthCall.url}`
40+
`${n}th call to fetch should have had a URL of ${url} but was ${nthCall.url}`,
4141
};
4242
},
4343

@@ -49,7 +49,7 @@ expect.extend({
4949
return {
5050
pass: false,
5151
message: () =>
52-
`fetch should have been called with a URL of ${url} ${times} times, but it was called ${calls.length} times`
52+
`fetch should have been called with a URL of ${url} ${times} times, but it was called ${calls.length} times`,
5353
};
5454
},
5555

@@ -63,7 +63,7 @@ expect.extend({
6363
message: () =>
6464
`fetch has not been called the expected number of times ${
6565
matcher ? `for ${matcher}` : 'in total'
66-
}`
66+
}`,
6767
};
68-
}
68+
},
6969
});

jestify.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
/*global jest*/
22
require('./jest-extensions');
33

4-
const jestify = fetchMockInstance => {
4+
const jestify = (fetchMockInstance) => {
55
const jestifiedInstance = new Proxy(fetchMockInstance, {
66
get: (originalFetchMock, name) => {
77
if (name === 'sandbox') {
88
return new Proxy(originalFetchMock[name], {
99
apply: (func, thisArg, args) => {
1010
const sandboxedFetchMock = func.apply(originalFetchMock, args);
1111
return jestify(sandboxedFetchMock);
12-
}
12+
},
1313
});
1414
}
1515
return originalFetchMock[name];
16-
}
16+
},
1717
});
1818

1919
// spy on the fetch handler so we can use all the
@@ -23,7 +23,7 @@ const jestify = fetchMockInstance => {
2323
// make sure all the jest expectation helpers can find what they need on fetchMock.mock
2424
Object.assign(jestifiedInstance.mock, jestifiedInstance.fetchHandler.mock);
2525

26-
['_isMockFunction', 'mockName', 'getMockName'].forEach(prop => {
26+
['_isMockFunction', 'mockName', 'getMockName'].forEach((prop) => {
2727
jestifiedInstance[prop] = jestifiedInstance.fetchHandler[prop];
2828
});
2929

@@ -101,4 +101,4 @@ const jestify = fetchMockInstance => {
101101
return jestifiedInstance;
102102
};
103103

104-
module.exports = fetchMock => jestify(fetchMock);
104+
module.exports = (fetchMock) => jestify(fetchMock);

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@
4545
"eslint-plugin-prettier": "^3.1.1",
4646
"jest": "^25.0.0",
4747
"node-fetch": "^2.6.0",
48-
"prettier": "^1.18.2"
48+
"prettier": "^2.0.4"
4949
}
5050
}

0 commit comments

Comments
 (0)