@wordpress/api-fetch 5.2.6 → 5.2.7-next.33ec3857e2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/src/test/index.js +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/api-fetch",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.7-next.33ec3857e2.0",
|
|
4
4
|
"description": "Utility to make WordPress REST API requests.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"types": "build-types",
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@babel/runtime": "^7.16.0",
|
|
31
|
-
"@wordpress/i18n": "^4.2.
|
|
32
|
-
"@wordpress/url": "^3.3.
|
|
31
|
+
"@wordpress/i18n": "^4.2.5-next.33ec3857e2.0",
|
|
32
|
+
"@wordpress/url": "^3.3.2-next.33ec3857e2.0"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "51c7917ea7fac72953702f24d6daac87d99e7617"
|
|
38
38
|
}
|
package/src/test/index.js
CHANGED
|
@@ -127,6 +127,7 @@ describe( 'apiFetch', () => {
|
|
|
127
127
|
);
|
|
128
128
|
|
|
129
129
|
return apiFetch( { path: '/random' } ).catch( ( body ) => {
|
|
130
|
+
// eslint-disable-next-line jest/no-conditional-expect
|
|
130
131
|
expect( body ).toEqual( {
|
|
131
132
|
code: 'bad_request',
|
|
132
133
|
message: 'Bad Request',
|
|
@@ -142,6 +143,7 @@ describe( 'apiFetch', () => {
|
|
|
142
143
|
);
|
|
143
144
|
|
|
144
145
|
return apiFetch( { path: '/random' } ).catch( ( body ) => {
|
|
146
|
+
// eslint-disable-next-line jest/no-conditional-expect
|
|
145
147
|
expect( body ).toEqual( {
|
|
146
148
|
code: 'invalid_json',
|
|
147
149
|
message: 'The response is not a valid JSON response.',
|
|
@@ -160,6 +162,7 @@ describe( 'apiFetch', () => {
|
|
|
160
162
|
);
|
|
161
163
|
|
|
162
164
|
return apiFetch( { path: '/random' } ).catch( ( body ) => {
|
|
165
|
+
// eslint-disable-next-line jest/no-conditional-expect
|
|
163
166
|
expect( body ).toEqual( {
|
|
164
167
|
code: 'invalid_json',
|
|
165
168
|
message: 'The response is not a valid JSON response.',
|
|
@@ -171,6 +174,7 @@ describe( 'apiFetch', () => {
|
|
|
171
174
|
window.fetch.mockReturnValue( Promise.reject() );
|
|
172
175
|
|
|
173
176
|
return apiFetch( { path: '/random' } ).catch( ( body ) => {
|
|
177
|
+
// eslint-disable-next-line jest/no-conditional-expect
|
|
174
178
|
expect( body ).toEqual( {
|
|
175
179
|
code: 'fetch_error',
|
|
176
180
|
message: 'You are probably offline.',
|
|
@@ -213,6 +217,7 @@ describe( 'apiFetch', () => {
|
|
|
213
217
|
);
|
|
214
218
|
|
|
215
219
|
return apiFetch( { path: '/random' } ).catch( ( body ) => {
|
|
220
|
+
// eslint-disable-next-line jest/no-conditional-expect
|
|
216
221
|
expect( body ).toEqual( null );
|
|
217
222
|
} );
|
|
218
223
|
} );
|
|
@@ -242,6 +247,7 @@ describe( 'apiFetch', () => {
|
|
|
242
247
|
|
|
243
248
|
return apiFetch( { path: '/random', parse: false } ).catch(
|
|
244
249
|
( response ) => {
|
|
250
|
+
// eslint-disable-next-line jest/no-conditional-expect
|
|
245
251
|
expect( response ).toEqual( {
|
|
246
252
|
status: 400,
|
|
247
253
|
} );
|