relay-test-utils-internal 13.1.1 → 14.1.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/consoleError.js.flow +70 -0
- package/consoleErrorsAndWarnings.js.flow +134 -0
- package/consoleWarning.js.flow +70 -0
- package/describeWithFeatureFlags.js.flow +0 -2
- package/getOutputForFixture.js.flow +0 -2
- package/index.js +1 -1
- package/index.js.flow +23 -3
- package/lib/consoleError.js +63 -0
- package/lib/consoleErrorsAndWarnings.js +116 -0
- package/lib/consoleWarning.js +63 -0
- package/lib/describeWithFeatureFlags.js +1 -2
- package/lib/generateTestsFromFixtures.js +1 -1
- package/lib/getOutputForFixture.js +0 -1
- package/lib/index.js +35 -13
- package/lib/printAST.js +1 -2
- package/lib/simpleClone.js +0 -1
- package/lib/testschema.graphql +6 -52
- package/lib/trackRetentionForEnvironment.js +64 -0
- package/lib/warnings.js +19 -63
- package/package.json +2 -2
- package/printAST.js.flow +0 -2
- package/relay-test-utils-internal.js +2 -2
- package/relay-test-utils-internal.min.js +2 -2
- package/simpleClone.js.flow +1 -3
- package/trackRetentionForEnvironment.js.flow +63 -0
- package/warnings.js.flow +28 -61
package/lib/index.js
CHANGED
@@ -7,14 +7,25 @@
|
|
7
7
|
*
|
8
8
|
* @format
|
9
9
|
*/
|
10
|
-
// flowlint ambiguous-object-type:error
|
11
10
|
'use strict';
|
12
11
|
|
12
|
+
var _require = require('./consoleError'),
|
13
|
+
disallowConsoleErrors = _require.disallowConsoleErrors,
|
14
|
+
expectConsoleError = _require.expectConsoleError,
|
15
|
+
expectConsoleErrorsMany = _require.expectConsoleErrorsMany,
|
16
|
+
expectConsoleErrorWillFire = _require.expectConsoleErrorWillFire;
|
17
|
+
|
18
|
+
var _require2 = require('./consoleWarning'),
|
19
|
+
disallowConsoleWarnings = _require2.disallowConsoleWarnings,
|
20
|
+
expectConsoleWarning = _require2.expectConsoleWarning,
|
21
|
+
expectConsoleWarningsMany = _require2.expectConsoleWarningsMany,
|
22
|
+
expectConsoleWarningWillFire = _require2.expectConsoleWarningWillFire;
|
23
|
+
|
13
24
|
var describeWithFeatureFlags = require('./describeWithFeatureFlags');
|
14
25
|
|
15
|
-
var
|
16
|
-
FIXTURE_TAG =
|
17
|
-
generateTestsFromFixtures =
|
26
|
+
var _require3 = require('./generateTestsFromFixtures'),
|
27
|
+
FIXTURE_TAG = _require3.FIXTURE_TAG,
|
28
|
+
generateTestsFromFixtures = _require3.generateTestsFromFixtures;
|
18
29
|
|
19
30
|
var Matchers = require('./Matchers');
|
20
31
|
|
@@ -22,15 +33,17 @@ var printAST = require('./printAST');
|
|
22
33
|
|
23
34
|
var simpleClone = require('./simpleClone');
|
24
35
|
|
25
|
-
var
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
36
|
+
var trackRetentionForEnvironment = require('./trackRetentionForEnvironment');
|
37
|
+
|
38
|
+
var _require4 = require('./warnings'),
|
39
|
+
disallowWarnings = _require4.disallowWarnings,
|
40
|
+
expectToWarn = _require4.expectToWarn,
|
41
|
+
expectToWarnMany = _require4.expectToWarnMany,
|
42
|
+
expectWarningWillFire = _require4.expectWarningWillFire;
|
30
43
|
|
31
|
-
var
|
32
|
-
createMockEnvironment =
|
33
|
-
unwrapContainer =
|
44
|
+
var _require5 = require('relay-test-utils'),
|
45
|
+
createMockEnvironment = _require5.createMockEnvironment,
|
46
|
+
unwrapContainer = _require5.unwrapContainer; // Apparently, in node v16 (because now they are using V8 V9.something)
|
34
47
|
// the content of the TypeError has changed, and now some of our tests
|
35
48
|
// stated to fail.
|
36
49
|
// This is a temporary work-around to make test pass, but we need to
|
@@ -53,14 +66,23 @@ module.exports = {
|
|
53
66
|
cannotReadPropertyOfUndefined__DEPRECATED: cannotReadPropertyOfUndefined__DEPRECATED,
|
54
67
|
createMockEnvironment: createMockEnvironment,
|
55
68
|
describeWithFeatureFlags: describeWithFeatureFlags,
|
69
|
+
disallowConsoleErrors: disallowConsoleErrors,
|
70
|
+
disallowConsoleWarnings: disallowConsoleWarnings,
|
71
|
+
disallowWarnings: disallowWarnings,
|
72
|
+
expectConsoleError: expectConsoleError,
|
73
|
+
expectConsoleErrorsMany: expectConsoleErrorsMany,
|
74
|
+
expectConsoleErrorWillFire: expectConsoleErrorWillFire,
|
75
|
+
expectConsoleWarningWillFire: expectConsoleWarningWillFire,
|
76
|
+
expectConsoleWarning: expectConsoleWarning,
|
77
|
+
expectConsoleWarningsMany: expectConsoleWarningsMany,
|
56
78
|
expectToWarn: expectToWarn,
|
57
79
|
expectToWarnMany: expectToWarnMany,
|
58
80
|
expectWarningWillFire: expectWarningWillFire,
|
59
|
-
disallowWarnings: disallowWarnings,
|
60
81
|
FIXTURE_TAG: FIXTURE_TAG,
|
61
82
|
generateTestsFromFixtures: generateTestsFromFixtures,
|
62
83
|
matchers: Matchers,
|
63
84
|
printAST: printAST,
|
64
85
|
simpleClone: simpleClone,
|
86
|
+
trackRetentionForEnvironment: trackRetentionForEnvironment,
|
65
87
|
unwrapContainer: unwrapContainer
|
66
88
|
};
|
package/lib/printAST.js
CHANGED
@@ -7,7 +7,6 @@
|
|
7
7
|
*
|
8
8
|
* @format
|
9
9
|
*/
|
10
|
-
// flowlint ambiguous-object-type:error
|
11
10
|
'use strict';
|
12
11
|
/**
|
13
12
|
* Prints a JSON AST similar to JSON.stringify(ast, null, 2) with some changes:
|
@@ -20,7 +19,7 @@
|
|
20
19
|
* }
|
21
20
|
*/
|
22
21
|
|
23
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
22
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
24
23
|
|
25
24
|
var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
|
26
25
|
|
package/lib/simpleClone.js
CHANGED
package/lib/testschema.graphql
CHANGED
@@ -69,6 +69,7 @@ interface MaybeNodeInterface {
|
|
69
69
|
}
|
70
70
|
|
71
71
|
scalar JSON
|
72
|
+
scalar NonNodeID
|
72
73
|
|
73
74
|
union MaybeNode = Story | FakeNode | NonNode
|
74
75
|
|
@@ -81,7 +82,7 @@ type FakeNode {
|
|
81
82
|
}
|
82
83
|
|
83
84
|
type NonNode {
|
84
|
-
id:
|
85
|
+
id: NonNodeID
|
85
86
|
name: String
|
86
87
|
}
|
87
88
|
|
@@ -143,28 +144,23 @@ type Subscription {
|
|
143
144
|
}
|
144
145
|
|
145
146
|
input ActorSubscribeInput {
|
146
|
-
clientMutationId: String
|
147
147
|
subscribeeId: ID
|
148
148
|
}
|
149
149
|
|
150
150
|
input ActorNameChangeInput {
|
151
|
-
clientMutationId: String
|
152
151
|
newName: String
|
153
152
|
}
|
154
153
|
|
155
154
|
input ApplicationRequestDeleteAllInput {
|
156
|
-
clientMutationId: String
|
157
155
|
deletedRequestIds: [ID]
|
158
156
|
}
|
159
157
|
|
160
158
|
input CommentCreateInput {
|
161
|
-
clientMutationId: String
|
162
159
|
feedbackId: ID
|
163
160
|
feedback: CommentfeedbackFeedback
|
164
161
|
}
|
165
162
|
|
166
163
|
input CommentsCreateInput {
|
167
|
-
clientMutationId: String
|
168
164
|
feedbackId: ID
|
169
165
|
feedback: [CommentfeedbackFeedback]
|
170
166
|
}
|
@@ -178,40 +174,33 @@ input FeedbackcommentComment {
|
|
178
174
|
}
|
179
175
|
|
180
176
|
input CommentCreateSubscriptionInput {
|
181
|
-
clientSubscriptionId: String
|
182
177
|
feedbackId: ID
|
183
178
|
text: String
|
184
179
|
}
|
185
180
|
|
186
181
|
input CommentDeleteInput {
|
187
|
-
clientMutationId: String
|
188
182
|
commentId: ID
|
189
183
|
}
|
190
184
|
|
191
185
|
input CommentsDeleteInput {
|
192
|
-
clientMutationId: String
|
193
186
|
commentIds: [ID]
|
194
187
|
}
|
195
188
|
|
196
189
|
input FeedbackLikeInput {
|
197
|
-
clientMutationId: String
|
198
190
|
feedbackId: ID
|
199
191
|
}
|
200
192
|
|
201
193
|
input FeedbackLikeInputStrict {
|
202
194
|
userID: ID!
|
203
|
-
clientMutationId: ID!
|
204
195
|
feedbackId: ID!
|
205
196
|
description: String
|
206
197
|
}
|
207
198
|
|
208
199
|
input NodeSaveStateInput {
|
209
|
-
clientMutationId: String
|
210
200
|
nodeId: ID
|
211
201
|
}
|
212
202
|
|
213
203
|
input UpdateAllSeenStateInput {
|
214
|
-
clientMutationId: String
|
215
204
|
storyIds: [ID]
|
216
205
|
}
|
217
206
|
|
@@ -221,22 +210,18 @@ input LocationInput {
|
|
221
210
|
}
|
222
211
|
|
223
212
|
type setLocationResponsePayload {
|
224
|
-
clientMutationId: String
|
225
213
|
viewer: Viewer
|
226
214
|
}
|
227
215
|
|
228
216
|
type ActorSubscribeResponsePayload {
|
229
|
-
clientMutationId: String
|
230
217
|
subscribee: Actor
|
231
218
|
}
|
232
219
|
|
233
220
|
type ActorNameChangePayload {
|
234
|
-
clientMutationId: String
|
235
221
|
actor: Actor
|
236
222
|
}
|
237
223
|
|
238
224
|
type ApplicationRequestDeleteAllResponsePayload {
|
239
|
-
clientMutationId: String
|
240
225
|
deletedRequestIds: [ID]
|
241
226
|
}
|
242
227
|
|
@@ -250,7 +235,6 @@ input CheckinSearchInput {
|
|
250
235
|
}
|
251
236
|
|
252
237
|
input StoryUpdateInput {
|
253
|
-
clientMutationId: String
|
254
238
|
body: InputText
|
255
239
|
}
|
256
240
|
|
@@ -322,6 +306,7 @@ type Comment implements Node {
|
|
322
306
|
subscribeStatus: String
|
323
307
|
subscribers(first: Int): SubscribersConnection
|
324
308
|
topLevelComments(first: Int): TopLevelCommentsConnection
|
309
|
+
commentsFrom(name: String!): [CommentsEdge]
|
325
310
|
tracking: String
|
326
311
|
url(relative: Boolean, site: String): String
|
327
312
|
websites: [String]
|
@@ -334,7 +319,6 @@ type ConfigCreateSubscriptResponsePayload {
|
|
334
319
|
}
|
335
320
|
|
336
321
|
type CommentCreateResponsePayload {
|
337
|
-
clientMutationId: String
|
338
322
|
comment: Comment
|
339
323
|
feedback: Feedback
|
340
324
|
feedbackCommentEdge: CommentsEdge
|
@@ -342,7 +326,6 @@ type CommentCreateResponsePayload {
|
|
342
326
|
}
|
343
327
|
|
344
328
|
type CommentsCreateResponsePayload {
|
345
|
-
clientMutationId: String
|
346
329
|
comments: [Comment]
|
347
330
|
feedback: [Feedback]
|
348
331
|
feedbackCommentEdges: [CommentsEdge]
|
@@ -350,19 +333,16 @@ type CommentsCreateResponsePayload {
|
|
350
333
|
}
|
351
334
|
|
352
335
|
type CommentDeleteResponsePayload {
|
353
|
-
clientMutationId: String
|
354
336
|
deletedCommentId: ID
|
355
337
|
feedback: Feedback
|
356
338
|
}
|
357
339
|
|
358
340
|
type CommentsDeleteResponsePayload {
|
359
|
-
clientMutationId: String
|
360
341
|
deletedCommentIds: [ID]
|
361
342
|
feedback: Feedback
|
362
343
|
}
|
363
344
|
|
364
345
|
type StoryUpdateResponsePayload {
|
365
|
-
clientMutationId: String
|
366
346
|
story: Story
|
367
347
|
}
|
368
348
|
|
@@ -478,8 +458,6 @@ type Feedback implements Node & HasJsField {
|
|
478
458
|
}
|
479
459
|
|
480
460
|
type FeedbackLikeResponsePayload {
|
481
|
-
clientMutationId: String
|
482
|
-
clientSubscriptionId: String
|
483
461
|
feedback: Feedback
|
484
462
|
}
|
485
463
|
|
@@ -938,13 +916,11 @@ type TopLevelCommentsConnection {
|
|
938
916
|
}
|
939
917
|
|
940
918
|
input UnfriendInput {
|
941
|
-
clientMutationId: String
|
942
919
|
friendId: ID
|
943
920
|
}
|
944
921
|
|
945
922
|
type UnfriendResponsePayload {
|
946
923
|
actor: Actor
|
947
|
-
clientMutationId: String
|
948
924
|
formerFriend: User
|
949
925
|
}
|
950
926
|
|
@@ -1211,38 +1187,16 @@ type Settings {
|
|
1211
1187
|
|
1212
1188
|
type IDFieldTests {
|
1213
1189
|
id_non_null: IDFieldIsIDNonNull
|
1190
|
+
id_null: IDFieldIsIDNull
|
1214
1191
|
id: IDFieldIsID
|
1215
|
-
list_of_id: IDFieldIsListOfID
|
1216
|
-
string_non_null: IDFieldIsStringNonNull
|
1217
|
-
string: IDFieldIsString
|
1218
|
-
int_non_null: IDFieldIsIntNonNull
|
1219
|
-
int: IDFieldIsInt
|
1220
|
-
object: IDFieldIsObject
|
1221
1192
|
}
|
1193
|
+
scalar IDFieldIsID
|
1222
1194
|
type IDFieldIsIDNonNull {
|
1223
1195
|
id: ID!
|
1224
1196
|
}
|
1225
|
-
type
|
1197
|
+
type IDFieldIsIDNull {
|
1226
1198
|
id: ID
|
1227
1199
|
}
|
1228
|
-
type IDFieldIsListOfID {
|
1229
|
-
id: [ID]
|
1230
|
-
}
|
1231
|
-
type IDFieldIsStringNonNull {
|
1232
|
-
id: String!
|
1233
|
-
}
|
1234
|
-
type IDFieldIsString {
|
1235
|
-
id: String
|
1236
|
-
}
|
1237
|
-
type IDFieldIsIntNonNull {
|
1238
|
-
id: Int!
|
1239
|
-
}
|
1240
|
-
type IDFieldIsInt {
|
1241
|
-
id: Int
|
1242
|
-
}
|
1243
|
-
type IDFieldIsObject {
|
1244
|
-
id: Node
|
1245
|
-
}
|
1246
1200
|
|
1247
1201
|
scalar ReactFlightComponent
|
1248
1202
|
scalar ReactFlightProps
|
@@ -0,0 +1,64 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
|
+
*
|
4
|
+
* This source code is licensed under the MIT license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*
|
7
|
+
*
|
8
|
+
* @format
|
9
|
+
*/
|
10
|
+
'use strict';
|
11
|
+
/* global jest */
|
12
|
+
|
13
|
+
/**
|
14
|
+
* Takes an environment and augments it with a mock implementation of `retain`
|
15
|
+
* that tracks what operations are currently retained. Also returns the Jest mock
|
16
|
+
* `release` function for backwards-compatibility with existing tests, but you
|
17
|
+
* should use `isOperationRetained` for new tests as it is much less error-prone.
|
18
|
+
*/
|
19
|
+
function trackRetentionForEnvironment(environment) {
|
20
|
+
var retainCountsByOperation = new Map();
|
21
|
+
var release = jest.fn(function (id) {
|
22
|
+
var _retainCountsByOperat;
|
23
|
+
|
24
|
+
var existing = (_retainCountsByOperat = retainCountsByOperation.get(id)) !== null && _retainCountsByOperat !== void 0 ? _retainCountsByOperat : NaN;
|
25
|
+
|
26
|
+
if (existing === 1) {
|
27
|
+
retainCountsByOperation["delete"](id);
|
28
|
+
} else {
|
29
|
+
retainCountsByOperation.set(id, existing - 1);
|
30
|
+
}
|
31
|
+
}); // $FlowFixMe[cannot-write] safe to do for mocking
|
32
|
+
|
33
|
+
environment.retain = jest.fn(function (operation) {
|
34
|
+
var _retainCountsByOperat2;
|
35
|
+
|
36
|
+
var id = operation.request.identifier;
|
37
|
+
var existing = (_retainCountsByOperat2 = retainCountsByOperation.get(id)) !== null && _retainCountsByOperat2 !== void 0 ? _retainCountsByOperat2 : 0;
|
38
|
+
retainCountsByOperation.set(id, existing + 1);
|
39
|
+
var released = false;
|
40
|
+
return {
|
41
|
+
dispose: function dispose() {
|
42
|
+
if (!released) {
|
43
|
+
release(id);
|
44
|
+
}
|
45
|
+
|
46
|
+
released = true;
|
47
|
+
}
|
48
|
+
};
|
49
|
+
});
|
50
|
+
|
51
|
+
function isOperationRetained(operation) {
|
52
|
+
var _retainCountsByOperat3;
|
53
|
+
|
54
|
+
var id = operation.request.identifier;
|
55
|
+
return ((_retainCountsByOperat3 = retainCountsByOperation.get(id)) !== null && _retainCountsByOperat3 !== void 0 ? _retainCountsByOperat3 : 0) > 0;
|
56
|
+
}
|
57
|
+
|
58
|
+
return {
|
59
|
+
release_DEPRECATED: release,
|
60
|
+
isOperationRetained: isOperationRetained
|
61
|
+
};
|
62
|
+
}
|
63
|
+
|
64
|
+
module.exports = trackRetentionForEnvironment;
|
package/lib/warnings.js
CHANGED
@@ -9,29 +9,12 @@
|
|
9
9
|
* @format
|
10
10
|
*/
|
11
11
|
'use strict';
|
12
|
-
/* global jest
|
12
|
+
/* global jest */
|
13
13
|
|
14
|
-
var
|
14
|
+
var _require = require('./consoleErrorsAndWarnings'),
|
15
|
+
createConsoleInterceptionSystem = _require.createConsoleInterceptionSystem;
|
15
16
|
|
16
|
-
var
|
17
|
-
|
18
|
-
var installed = false;
|
19
|
-
var expectedWarnings = [];
|
20
|
-
var contextualExpectedWarning = [];
|
21
|
-
/**
|
22
|
-
* Mocks the `warning` module to turn warnings into errors. Any expected
|
23
|
-
* warnings need to be explicitly expected with `expectWarningWillFire(message)`.
|
24
|
-
*
|
25
|
-
* NOTE: This should be called on top of a test file. The test should NOT
|
26
|
-
* use `jest.resetModules()` or manually mock `warning`.
|
27
|
-
*/
|
28
|
-
|
29
|
-
function disallowWarnings() {
|
30
|
-
if (installed) {
|
31
|
-
throw new Error('`disallowWarnings` should be called at most once');
|
32
|
-
}
|
33
|
-
|
34
|
-
installed = true;
|
17
|
+
var warningsSystem = createConsoleInterceptionSystem('warning', 'expectToWarn', function (impl) {
|
35
18
|
jest.mock("fbjs/lib/warning", function () {
|
36
19
|
return jest.fn(function (condition, format) {
|
37
20
|
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
@@ -43,31 +26,21 @@ function disallowWarnings() {
|
|
43
26
|
var message = format.replace(/%s/g, function () {
|
44
27
|
return String(args[argIndex++]);
|
45
28
|
});
|
46
|
-
|
47
|
-
|
48
|
-
if (contextualExpectedWarning.length > 0 && contextualExpectedWarning[0] === message) {
|
49
|
-
contextualExpectedWarning.shift();
|
50
|
-
} else if (index >= 0) {
|
51
|
-
expectedWarnings.splice(index, 1);
|
52
|
-
} else {
|
53
|
-
// log to console in case the error gets swallowed somewhere
|
54
|
-
console.error('Unexpected Warning: ' + message);
|
55
|
-
throw new Error('Warning: ' + message);
|
56
|
-
}
|
29
|
+
impl(message);
|
57
30
|
}
|
58
31
|
});
|
59
32
|
});
|
60
|
-
|
61
|
-
|
33
|
+
});
|
34
|
+
/**
|
35
|
+
* Mocks the `warning` module to turn warnings into errors. Any expected
|
36
|
+
* warnings need to be explicitly expected with `expectWarningWillFire(message)`.
|
37
|
+
*
|
38
|
+
* NOTE: This should be called on top of a test file. The test should NOT
|
39
|
+
* use `jest.resetModules()` or manually mock `warning`.
|
40
|
+
*/
|
62
41
|
|
63
|
-
|
64
|
-
|
65
|
-
return " * ".concat(message);
|
66
|
-
}).join('\n') + '\n');
|
67
|
-
expectedWarnings.length = 0;
|
68
|
-
throw error;
|
69
|
-
}
|
70
|
-
});
|
42
|
+
function disallowWarnings() {
|
43
|
+
warningsSystem.disallowMessages();
|
71
44
|
}
|
72
45
|
/**
|
73
46
|
* Expect a warning with the given message. If the message isn't fired in the
|
@@ -75,12 +48,8 @@ function disallowWarnings() {
|
|
75
48
|
*/
|
76
49
|
|
77
50
|
|
78
|
-
function expectWarningWillFire(message) {
|
79
|
-
|
80
|
-
throw new Error('`disallowWarnings` needs to be called before `expectWarningWillFire`');
|
81
|
-
}
|
82
|
-
|
83
|
-
expectedWarnings.push(message);
|
51
|
+
function expectWarningWillFire(message, options) {
|
52
|
+
warningsSystem.expectMessageWillFire(message, options);
|
84
53
|
}
|
85
54
|
/**
|
86
55
|
* Expect the callback `fn` to trigger the warning message and otherwise fail.
|
@@ -88,7 +57,7 @@ function expectWarningWillFire(message) {
|
|
88
57
|
|
89
58
|
|
90
59
|
function expectToWarn(message, fn) {
|
91
|
-
return
|
60
|
+
return warningsSystem.expectMessage(message, fn);
|
92
61
|
}
|
93
62
|
/**
|
94
63
|
* Expect the callback `fn` to trigger all warning messages (in sequence)
|
@@ -97,20 +66,7 @@ function expectToWarn(message, fn) {
|
|
97
66
|
|
98
67
|
|
99
68
|
function expectToWarnMany(messages, fn) {
|
100
|
-
|
101
|
-
throw new Error('Cannot nest `expectToWarn()` calls.');
|
102
|
-
}
|
103
|
-
|
104
|
-
contextualExpectedWarning.push.apply(contextualExpectedWarning, (0, _toConsumableArray2["default"])(messages));
|
105
|
-
var result = fn();
|
106
|
-
|
107
|
-
if (contextualExpectedWarning.length > 0) {
|
108
|
-
var notFired = contextualExpectedWarning.toString();
|
109
|
-
contextualExpectedWarning.length = 0;
|
110
|
-
throw new Error("Expected callback to warn: ".concat(notFired));
|
111
|
-
}
|
112
|
-
|
113
|
-
return result;
|
69
|
+
return warningsSystem.expectMessageMany(messages, fn);
|
114
70
|
}
|
115
71
|
|
116
72
|
module.exports = {
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "relay-test-utils-internal",
|
3
3
|
"description": "Internal utilities for testing Relay.",
|
4
|
-
"version": "
|
4
|
+
"version": "14.1.0",
|
5
5
|
"keywords": [
|
6
6
|
"graphql",
|
7
7
|
"relay"
|
@@ -17,7 +17,7 @@
|
|
17
17
|
"dependencies": {
|
18
18
|
"@babel/runtime": "^7.0.0",
|
19
19
|
"fbjs": "^3.0.2",
|
20
|
-
"relay-runtime": "
|
20
|
+
"relay-runtime": "14.1.0"
|
21
21
|
},
|
22
22
|
"directories": {
|
23
23
|
"": "./"
|
package/printAST.js.flow
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
/**
|
2
|
-
* Relay
|
2
|
+
* Relay v14.1.0
|
3
3
|
*/
|
4
|
-
module.exports=function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=2)}([function(e,n){e.exports=require("@babel/runtime/helpers/interopRequireDefault")},function(e,n){e.exports=require("relay-runtime")},function(e,n,t){"use strict";var r=t(3),o=t(5),i=o.FIXTURE_TAG,a=o.generateTestsFromFixtures,c=t(10),u=t(12),s=t(14),f=t(15),l=f.disallowWarnings,p=f.expectToWarn,d=f.expectToWarnMany,g=f.expectWarningWillFire,h=t(17),x=h.createMockEnvironment,y=h.unwrapContainer;e.exports={cannotReadPropertyOfUndefined__DEPRECATED:function(e){return process.version.match(/^v16\.(.+)$/)?"Cannot read properties of undefined (reading '".concat(e,"')"):"Cannot read property '".concat(e,"' of undefined")},createMockEnvironment:x,describeWithFeatureFlags:r,expectToWarn:p,expectToWarnMany:d,expectWarningWillFire:g,disallowWarnings:l,FIXTURE_TAG:i,generateTestsFromFixtures:a,matchers:c,printAST:u,simpleClone:s,unwrapContainer:y}},function(e,n,t){"use strict";var r=t(0)(t(4));e.exports=function(e,n,o){describe.each(e)("".concat(n," - Feature flags: %o"),(function(e){var n;beforeEach((function(){var o=t(1).RelayFeatureFlags;n=(0,r.default)({},o),Object.assign(o,e)})),afterEach((function(){var e=t(1).RelayFeatureFlags;Object.assign(e,n)})),o()}))}},function(e,n){e.exports=require("@babel/runtime/helpers/objectSpread2")},function(e,n,t){"use strict";var r=t(0)(t(6)),o=t(7),i=t(8),a=t(9),c=Symbol.for("FIXTURE_TAG");expect.addSnapshotSerializer({print:function(e){return Object.keys(e).map((function(n){return"~~~~~~~~~~ ".concat(n.toUpperCase()," ~~~~~~~~~~\n").concat(e[n])})).join("\n")},test:function(e){return e&&!0===e[c]}}),e.exports={generateTestsFromFixtures:function(e,n){var t=i.readdirSync(e);test("has fixtures in ".concat(e),(function(){expect(t.length>0).toBe(!0)}));var u=t.filter((function(e){return e.startsWith("only.")}));u.length&&(test.skip.each(t.filter((function(e){return!e.startsWith("only.")})))("matches expected output: %s",(function(){})),t=u),test.each(t)("matches expected output: %s",(function(t){var u,s=i.readFileSync(a.join(e,t),"utf8"),f=o(s,n,t);expect((u={},(0,r.default)(u,c,!0),(0,r.default)(u,"input",s),(0,r.default)(u,"output",f),u)).toMatchSnapshot()}))},FIXTURE_TAG:c}},function(e,n){e.exports=require("@babel/runtime/helpers/defineProperty")},function(e,n,t){"use strict";e.exports=function(e,n,t){if(/^# *expected-to-throw/.test(e)||/\.error\.\w+$/.test(t)){var r;try{r=n(e)}catch(e){return"THROWN EXCEPTION:\n\n".concat(e.toString())}throw new Error("Expected test file '".concat(t,"' to throw, but it passed:\n").concat(r))}return n(e)}},function(e,n){e.exports=require("fs")},function(e,n){e.exports=require("path")},function(e,n,t){"use strict";e.exports={toBeDeeplyFrozen:function(e){return function e(n){if(expect(Object.isFrozen(n)).toBe(!0),Array.isArray(n))n.forEach((function(n){return e(n)}));else if("object"==typeof n&&null!==n)for(var t in n)e(n[t])}(e),{pass:!0}},toWarn:function(e,n){var r=this.isNot;function o(e){return e instanceof RegExp?e.toString():JSON.stringify(e)}function i(e){return"["+e.map(o).join(", ")+"]"}function a(e){return e.length?e.map((function(e){return i([!!e[0]].concat(e.slice(1)))})).join(", "):"[]"}var c=t(11);if(!c.mock)throw new Error("toWarn(): Requires `jest.mock('warning')`.");var u=c.mock.calls.length;e();var s=c.mock.calls.slice(u);return n?(Array.isArray(n)||(n=[n]),{pass:!!s.find((function(e){return e.length===n.length+1&&e.every((function(e,t){if(!t)return!e;var r=n[t-1];return r instanceof RegExp?r.test(e):e===r}))})),message:function(){return"Expected ".concat(r?"not ":"","to warn: ")+"".concat(i([!1].concat(n))," but ")+"`warning` received the following calls: "+"".concat(a(s),".")}}):{pass:!!s.filter((function(e){return!e[0]})).length,message:function(){return"Expected ".concat(r?"not ":"","to warn but ")+"`warning` received the following calls: "+"".concat(a(s),".")}}}}},function(e,n){e.exports=require("fbjs/lib/warning")},function(e,n,t){"use strict";var r=t(0)(t(13));e.exports=function(e){return function e(n,t){switch(typeof n){case"undefined":return"undefined";case"object":if(null===n)return"null";if(Array.isArray(n)){if(0===n.length)return"[]";var o,i="[\n",a=t+" ",c=(0,r.default)(n);try{for(c.s();!(o=c.n()).done;){var u=o.value;i+=a+e(u,a)+",\n"}}catch(e){c.e(e)}finally{c.f()}return i+=t+"]"}if("string"==typeof n.kind){for(var s="".concat(n.kind," {\n"),f=t+" ",l=0,p=Object.entries(n);l<p.length;l++){var d=p[l],g=d[0],h=d[1];"kind"!==g&&(s+="".concat(f).concat(g,": ").concat(e(h,f),",\n"))}return s+=t+"}"}if("function"==typeof n.toJSON)return e(n.toJSON(),t);for(var x="{\n",y=t+" ",b=0,v=Object.entries(n);b<v.length;b++){var w=v[b],m=w[0],E=w[1];x+="".concat(y).concat(JSON.stringify(m),": ").concat(e(E,y),",\n")}return x+=t+"}";case"string":case"number":case"boolean":return JSON.stringify(n,null,2).replace("\n","\n"+t);default:throw new Error("printAST doesn't handle values where "+"typeof value === '".concat(typeof n,"'."))}}(e,"")}},function(e,n){e.exports=require("@babel/runtime/helpers/createForOfIteratorHelper")},function(e,n,t){"use strict";e.exports=function e(n){if(Array.isArray(n))return n.map(e);if(null!=n&&"object"==typeof n){var t={};for(var r in n)t[r]=e(n[r]);return t}return n}},function(e,n,t){"use strict";var r=t(0)(t(16)),o=!1,i=[],a=[];function c(e,n){if(a.length>0)throw new Error("Cannot nest `expectToWarn()` calls.");a.push.apply(a,(0,r.default)(e));var t=n();if(a.length>0){var o=a.toString();throw a.length=0,new Error("Expected callback to warn: ".concat(o))}return t}e.exports={disallowWarnings:function(){if(o)throw new Error("`disallowWarnings` should be called at most once");o=!0,jest.mock("fbjs/lib/warning",(function(){return jest.fn((function(e,n){for(var t=arguments.length,r=new Array(t>2?t-2:0),o=2;o<t;o++)r[o-2]=arguments[o];if(!e){var c=0,u=n.replace(/%s/g,(function(){return String(r[c++])})),s=i.indexOf(u);if(a.length>0&&a[0]===u)a.shift();else{if(!(s>=0))throw console.error("Unexpected Warning: "+u),new Error("Warning: "+u);i.splice(s,1)}}}))})),afterEach((function(){if(a.length=0,i.length>0){var e=new Error("Some expected warnings where not triggered:\n\n"+Array.from(i,(function(e){return" * ".concat(e)})).join("\n")+"\n");throw i.length=0,e}}))},expectWarningWillFire:function(e){if(!o)throw new Error("`disallowWarnings` needs to be called before `expectWarningWillFire`");i.push(e)},expectToWarn:function(e,n){return c([e],n)},expectToWarnMany:c}},function(e,n){e.exports=require("@babel/runtime/helpers/toConsumableArray")},function(e,n){e.exports=require("relay-test-utils")}]);
|
4
|
+
module.exports=function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=3)}([function(e,n){e.exports=require("@babel/runtime/helpers/interopRequireDefault")},function(e,n,t){"use strict";var r=(0,t(0).default)(t(5)),o=console.error;e.exports={createConsoleInterceptionSystem:function(e,n,t){var i=!1,c=[],a=[],s=[],u=e.charAt(0).toUpperCase()+e.slice(1),l=u+"s",f="disallow".concat(u,"s");function p(e){var n=c.findIndex((function(n){return e.startsWith(n)})),t=a.findIndex((function(n){return e.startsWith(n)}));if(s.length>0&&e.startsWith(s[0]))s.shift();else if(n>=0)c.splice(n,1);else{if(!(t>=0))throw o("Unexpected ".concat(u,": ")+e),new Error("".concat(u,": ")+e);a.splice(t,1)}}function d(t,o){if(s.length>0)throw new Error("Cannot nest ".concat(n,"() calls."));s.push.apply(s,(0,r.default)(t));var i=o();if(s.length>0){var c=s.toString();throw s.length=0,new Error("Expected ".concat(e," in callback: ").concat(c))}return i}return{disallowMessages:function(){if(i)throw new Error("".concat(f," should be called only once."));i=!0,t(p),afterEach((function(){if(a.length=0,s.length=0,c.length>0){var n=new Error("Some ".concat(c.length," expected ").concat(e,"s where not triggered:\n\n")+Array.from(c,(function(e){return" * ".concat(e)})).join("\n")+"\n");throw c.length=0,n}}))},expectMessageWillFire:function(e,n){if(!i)throw new Error("".concat(f," needs to be called before expect").concat(l,"WillFire"));for(var t=!0===(null==n?void 0:n.optional),r=0;r<(null!==(o=null==n?void 0:n.count)&&void 0!==o?o:1);r++){var o;(t?a:c).push(e)}},expectMessage:function(e,n){return d([e],n)},expectMessageMany:d}}}},function(e,n){e.exports=require("relay-runtime")},function(e,n,t){"use strict";var r=t(4),o=r.disallowConsoleErrors,i=r.expectConsoleError,c=r.expectConsoleErrorsMany,a=r.expectConsoleErrorWillFire,s=t(6),u=s.disallowConsoleWarnings,l=s.expectConsoleWarning,f=s.expectConsoleWarningsMany,p=s.expectConsoleWarningWillFire,d=t(7),g=t(9),x=g.FIXTURE_TAG,h=g.generateTestsFromFixtures,y=t(14),v=t(16),w=t(18),b=t(19),m=t(20),W=m.disallowWarnings,E=m.expectToWarn,C=m.expectToWarnMany,M=m.expectWarningWillFire,F=t(21),j=F.createMockEnvironment,S=F.unwrapContainer;e.exports={cannotReadPropertyOfUndefined__DEPRECATED:function(e){return process.version.match(/^v16\.(.+)$/)?"Cannot read properties of undefined (reading '".concat(e,"')"):"Cannot read property '".concat(e,"' of undefined")},createMockEnvironment:j,describeWithFeatureFlags:d,disallowConsoleErrors:o,disallowConsoleWarnings:u,disallowWarnings:W,expectConsoleError:i,expectConsoleErrorsMany:c,expectConsoleErrorWillFire:a,expectConsoleWarningWillFire:p,expectConsoleWarning:l,expectConsoleWarningsMany:f,expectToWarn:E,expectToWarnMany:C,expectWarningWillFire:M,FIXTURE_TAG:x,generateTestsFromFixtures:h,matchers:y,printAST:v,simpleClone:w,trackRetentionForEnvironment:b,unwrapContainer:S}},function(e,n,t){"use strict";var r=(0,t(1).createConsoleInterceptionSystem)("error","expectConsoleError",(function(e){jest.spyOn(console,"error").mockImplementation(e)}));e.exports={disallowConsoleErrors:function(){r.disallowMessages()},expectConsoleErrorWillFire:function(e,n){r.expectMessageWillFire(e,n)},expectConsoleError:function(e,n){return r.expectMessage(e,n)},expectConsoleErrorsMany:function(e,n){return r.expectMessageMany(e,n)}}},function(e,n){e.exports=require("@babel/runtime/helpers/toConsumableArray")},function(e,n,t){"use strict";var r=(0,t(1).createConsoleInterceptionSystem)("warning","expectConsoleWarning",(function(e){jest.spyOn(console,"warn").mockImplementation(e)}));e.exports={disallowConsoleWarnings:function(){r.disallowMessages()},expectConsoleWarningWillFire:function(e,n){r.expectMessageWillFire(e,n)},expectConsoleWarning:function(e,n){return r.expectMessage(e,n)},expectConsoleWarningsMany:function(e,n){return r.expectMessageMany(e,n)}}},function(e,n,t){"use strict";var r=(0,t(0).default)(t(8));e.exports=function(e,n,o){describe.each(e)("".concat(n," - Feature flags: %o"),(function(e){var n;beforeEach((function(){var o=t(2).RelayFeatureFlags;n=(0,r.default)({},o),Object.assign(o,e)})),afterEach((function(){var e=t(2).RelayFeatureFlags;Object.assign(e,n)})),o()}))}},function(e,n){e.exports=require("@babel/runtime/helpers/objectSpread2")},function(e,n,t){"use strict";var r=(0,t(0).default)(t(10)),o=t(11),i=t(12),c=t(13),a=Symbol.for("FIXTURE_TAG");expect.addSnapshotSerializer({print:function(e){return Object.keys(e).map((function(n){return"~~~~~~~~~~ ".concat(n.toUpperCase()," ~~~~~~~~~~\n").concat(e[n])})).join("\n")},test:function(e){return e&&!0===e[a]}}),e.exports={generateTestsFromFixtures:function(e,n){var t=i.readdirSync(e);test("has fixtures in ".concat(e),(function(){expect(t.length>0).toBe(!0)}));var s=t.filter((function(e){return e.startsWith("only.")}));s.length&&(test.skip.each(t.filter((function(e){return!e.startsWith("only.")})))("matches expected output: %s",(function(){})),t=s),test.each(t)("matches expected output: %s",(function(t){var s,u=i.readFileSync(c.join(e,t),"utf8"),l=o(u,n,t);expect((s={},(0,r.default)(s,a,!0),(0,r.default)(s,"input",u),(0,r.default)(s,"output",l),s)).toMatchSnapshot()}))},FIXTURE_TAG:a}},function(e,n){e.exports=require("@babel/runtime/helpers/defineProperty")},function(e,n,t){"use strict";e.exports=function(e,n,t){if(/^# *expected-to-throw/.test(e)||/\.error\.\w+$/.test(t)){var r;try{r=n(e)}catch(e){return"THROWN EXCEPTION:\n\n".concat(e.toString())}throw new Error("Expected test file '".concat(t,"' to throw, but it passed:\n").concat(r))}return n(e)}},function(e,n){e.exports=require("fs")},function(e,n){e.exports=require("path")},function(e,n,t){"use strict";e.exports={toBeDeeplyFrozen:function(e){return function e(n){if(expect(Object.isFrozen(n)).toBe(!0),Array.isArray(n))n.forEach((function(n){return e(n)}));else if("object"==typeof n&&null!==n)for(var t in n)e(n[t])}(e),{pass:!0}},toWarn:function(e,n){var r=this.isNot;function o(e){return e instanceof RegExp?e.toString():JSON.stringify(e)}function i(e){return"["+e.map(o).join(", ")+"]"}function c(e){return e.length?e.map((function(e){return i([!!e[0]].concat(e.slice(1)))})).join(", "):"[]"}var a=t(15);if(!a.mock)throw new Error("toWarn(): Requires `jest.mock('warning')`.");var s=a.mock.calls.length;e();var u=a.mock.calls.slice(s);return n?(Array.isArray(n)||(n=[n]),{pass:!!u.find((function(e){return e.length===n.length+1&&e.every((function(e,t){if(!t)return!e;var r=n[t-1];return r instanceof RegExp?r.test(e):e===r}))})),message:function(){return"Expected ".concat(r?"not ":"","to warn: ")+"".concat(i([!1].concat(n))," but ")+"`warning` received the following calls: "+"".concat(c(u),".")}}):{pass:!!u.filter((function(e){return!e[0]})).length,message:function(){return"Expected ".concat(r?"not ":"","to warn but ")+"`warning` received the following calls: "+"".concat(c(u),".")}}}}},function(e,n){e.exports=require("fbjs/lib/warning")},function(e,n,t){"use strict";var r=(0,t(0).default)(t(17));e.exports=function(e){return function e(n,t){switch(typeof n){case"undefined":return"undefined";case"object":if(null===n)return"null";if(Array.isArray(n)){if(0===n.length)return"[]";var o,i="[\n",c=t+" ",a=(0,r.default)(n);try{for(a.s();!(o=a.n()).done;){var s=o.value;i+=c+e(s,c)+",\n"}}catch(e){a.e(e)}finally{a.f()}return i+=t+"]"}if("string"==typeof n.kind){for(var u="".concat(n.kind," {\n"),l=t+" ",f=0,p=Object.entries(n);f<p.length;f++){var d=p[f],g=d[0],x=d[1];"kind"!==g&&(u+="".concat(l).concat(g,": ").concat(e(x,l),",\n"))}return u+=t+"}"}if("function"==typeof n.toJSON)return e(n.toJSON(),t);for(var h="{\n",y=t+" ",v=0,w=Object.entries(n);v<w.length;v++){var b=w[v],m=b[0],W=b[1];h+="".concat(y).concat(JSON.stringify(m),": ").concat(e(W,y),",\n")}return h+=t+"}";case"string":case"number":case"boolean":return JSON.stringify(n,null,2).replace("\n","\n"+t);default:throw new Error("printAST doesn't handle values where "+"typeof value === '".concat(typeof n,"'."))}}(e,"")}},function(e,n){e.exports=require("@babel/runtime/helpers/createForOfIteratorHelper")},function(e,n,t){"use strict";e.exports=function e(n){if(Array.isArray(n))return n.map(e);if(null!=n&&"object"==typeof n){var t={};for(var r in n)t[r]=e(n[r]);return t}return n}},function(e,n,t){"use strict";e.exports=function(e){var n=new Map,t=jest.fn((function(e){var t,r=null!==(t=n.get(e))&&void 0!==t?t:NaN;1===r?n.delete(e):n.set(e,r-1)}));return e.retain=jest.fn((function(e){var r,o=e.request.identifier,i=null!==(r=n.get(o))&&void 0!==r?r:0;n.set(o,i+1);var c=!1;return{dispose:function(){c||t(o),c=!0}}})),{release_DEPRECATED:t,isOperationRetained:function(e){var t,r=e.request.identifier;return(null!==(t=n.get(r))&&void 0!==t?t:0)>0}}}},function(e,n,t){"use strict";var r=(0,t(1).createConsoleInterceptionSystem)("warning","expectToWarn",(function(e){jest.mock("fbjs/lib/warning",(function(){return jest.fn((function(n,t){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];if(!n){var c=0,a=t.replace(/%s/g,(function(){return String(o[c++])}));e(a)}}))}))}));e.exports={disallowWarnings:function(){r.disallowMessages()},expectWarningWillFire:function(e,n){r.expectMessageWillFire(e,n)},expectToWarn:function(e,n){return r.expectMessage(e,n)},expectToWarnMany:function(e,n){return r.expectMessageMany(e,n)}}},function(e,n){e.exports=require("relay-test-utils")}]);
|
@@ -1,9 +1,9 @@
|
|
1
1
|
/**
|
2
|
-
* Relay
|
2
|
+
* Relay v14.1.0
|
3
3
|
*
|
4
4
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
5
5
|
*
|
6
6
|
* This source code is licensed under the MIT license found in the
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
8
8
|
*/
|
9
|
-
module.exports=function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=2)}([function(e,n){e.exports=require("@babel/runtime/helpers/interopRequireDefault")},function(e,n){e.exports=require("relay-runtime")},function(e,n,t){"use strict";var r=t(3),o=t(5),i=o.FIXTURE_TAG,a=o.generateTestsFromFixtures,c=t(10),u=t(12),s=t(14),f=t(15),l=f.disallowWarnings,p=f.expectToWarn,d=f.expectToWarnMany,g=f.expectWarningWillFire,h=t(17),x=h.createMockEnvironment,y=h.unwrapContainer;e.exports={cannotReadPropertyOfUndefined__DEPRECATED:function(e){return process.version.match(/^v16\.(.+)$/)?"Cannot read properties of undefined (reading '".concat(e,"')"):"Cannot read property '".concat(e,"' of undefined")},createMockEnvironment:x,describeWithFeatureFlags:r,expectToWarn:p,expectToWarnMany:d,expectWarningWillFire:g,disallowWarnings:l,FIXTURE_TAG:i,generateTestsFromFixtures:a,matchers:c,printAST:u,simpleClone:s,unwrapContainer:y}},function(e,n,t){"use strict";var r=t(0)(t(4));e.exports=function(e,n,o){describe.each(e)("".concat(n," - Feature flags: %o"),(function(e){var n;beforeEach((function(){var o=t(1).RelayFeatureFlags;n=(0,r.default)({},o),Object.assign(o,e)})),afterEach((function(){var e=t(1).RelayFeatureFlags;Object.assign(e,n)})),o()}))}},function(e,n){e.exports=require("@babel/runtime/helpers/objectSpread2")},function(e,n,t){"use strict";var r=t(0)(t(6)),o=t(7),i=t(8),a=t(9),c=Symbol.for("FIXTURE_TAG");expect.addSnapshotSerializer({print:function(e){return Object.keys(e).map((function(n){return"~~~~~~~~~~ ".concat(n.toUpperCase()," ~~~~~~~~~~\n").concat(e[n])})).join("\n")},test:function(e){return e&&!0===e[c]}}),e.exports={generateTestsFromFixtures:function(e,n){var t=i.readdirSync(e);test("has fixtures in ".concat(e),(function(){expect(t.length>0).toBe(!0)}));var u=t.filter((function(e){return e.startsWith("only.")}));u.length&&(test.skip.each(t.filter((function(e){return!e.startsWith("only.")})))("matches expected output: %s",(function(){})),t=u),test.each(t)("matches expected output: %s",(function(t){var u,s=i.readFileSync(a.join(e,t),"utf8"),f=o(s,n,t);expect((u={},(0,r.default)(u,c,!0),(0,r.default)(u,"input",s),(0,r.default)(u,"output",f),u)).toMatchSnapshot()}))},FIXTURE_TAG:c}},function(e,n){e.exports=require("@babel/runtime/helpers/defineProperty")},function(e,n,t){"use strict";e.exports=function(e,n,t){if(/^# *expected-to-throw/.test(e)||/\.error\.\w+$/.test(t)){var r;try{r=n(e)}catch(e){return"THROWN EXCEPTION:\n\n".concat(e.toString())}throw new Error("Expected test file '".concat(t,"' to throw, but it passed:\n").concat(r))}return n(e)}},function(e,n){e.exports=require("fs")},function(e,n){e.exports=require("path")},function(e,n,t){"use strict";e.exports={toBeDeeplyFrozen:function(e){return function e(n){if(expect(Object.isFrozen(n)).toBe(!0),Array.isArray(n))n.forEach((function(n){return e(n)}));else if("object"==typeof n&&null!==n)for(var t in n)e(n[t])}(e),{pass:!0}},toWarn:function(e,n){var r=this.isNot;function o(e){return e instanceof RegExp?e.toString():JSON.stringify(e)}function i(e){return"["+e.map(o).join(", ")+"]"}function a(e){return e.length?e.map((function(e){return i([!!e[0]].concat(e.slice(1)))})).join(", "):"[]"}var c=t(11);if(!c.mock)throw new Error("toWarn(): Requires `jest.mock('warning')`.");var u=c.mock.calls.length;e();var s=c.mock.calls.slice(u);return n?(Array.isArray(n)||(n=[n]),{pass:!!s.find((function(e){return e.length===n.length+1&&e.every((function(e,t){if(!t)return!e;var r=n[t-1];return r instanceof RegExp?r.test(e):e===r}))})),message:function(){return"Expected ".concat(r?"not ":"","to warn: ")+"".concat(i([!1].concat(n))," but ")+"`warning` received the following calls: "+"".concat(a(s),".")}}):{pass:!!s.filter((function(e){return!e[0]})).length,message:function(){return"Expected ".concat(r?"not ":"","to warn but ")+"`warning` received the following calls: "+"".concat(a(s),".")}}}}},function(e,n){e.exports=require("fbjs/lib/warning")},function(e,n,t){"use strict";var r=t(0)(t(13));e.exports=function(e){return function e(n,t){switch(typeof n){case"undefined":return"undefined";case"object":if(null===n)return"null";if(Array.isArray(n)){if(0===n.length)return"[]";var o,i="[\n",a=t+" ",c=(0,r.default)(n);try{for(c.s();!(o=c.n()).done;){var u=o.value;i+=a+e(u,a)+",\n"}}catch(e){c.e(e)}finally{c.f()}return i+=t+"]"}if("string"==typeof n.kind){for(var s="".concat(n.kind," {\n"),f=t+" ",l=0,p=Object.entries(n);l<p.length;l++){var d=p[l],g=d[0],h=d[1];"kind"!==g&&(s+="".concat(f).concat(g,": ").concat(e(h,f),",\n"))}return s+=t+"}"}if("function"==typeof n.toJSON)return e(n.toJSON(),t);for(var x="{\n",y=t+" ",b=0,v=Object.entries(n);b<v.length;b++){var w=v[b],m=w[0],E=w[1];x+="".concat(y).concat(JSON.stringify(m),": ").concat(e(E,y),",\n")}return x+=t+"}";case"string":case"number":case"boolean":return JSON.stringify(n,null,2).replace("\n","\n"+t);default:throw new Error("printAST doesn't handle values where "+"typeof value === '".concat(typeof n,"'."))}}(e,"")}},function(e,n){e.exports=require("@babel/runtime/helpers/createForOfIteratorHelper")},function(e,n,t){"use strict";e.exports=function e(n){if(Array.isArray(n))return n.map(e);if(null!=n&&"object"==typeof n){var t={};for(var r in n)t[r]=e(n[r]);return t}return n}},function(e,n,t){"use strict";var r=t(0)(t(16)),o=!1,i=[],a=[];function c(e,n){if(a.length>0)throw new Error("Cannot nest `expectToWarn()` calls.");a.push.apply(a,(0,r.default)(e));var t=n();if(a.length>0){var o=a.toString();throw a.length=0,new Error("Expected callback to warn: ".concat(o))}return t}e.exports={disallowWarnings:function(){if(o)throw new Error("`disallowWarnings` should be called at most once");o=!0,jest.mock("fbjs/lib/warning",(function(){return jest.fn((function(e,n){for(var t=arguments.length,r=new Array(t>2?t-2:0),o=2;o<t;o++)r[o-2]=arguments[o];if(!e){var c=0,u=n.replace(/%s/g,(function(){return String(r[c++])})),s=i.indexOf(u);if(a.length>0&&a[0]===u)a.shift();else{if(!(s>=0))throw console.error("Unexpected Warning: "+u),new Error("Warning: "+u);i.splice(s,1)}}}))})),afterEach((function(){if(a.length=0,i.length>0){var e=new Error("Some expected warnings where not triggered:\n\n"+Array.from(i,(function(e){return" * ".concat(e)})).join("\n")+"\n");throw i.length=0,e}}))},expectWarningWillFire:function(e){if(!o)throw new Error("`disallowWarnings` needs to be called before `expectWarningWillFire`");i.push(e)},expectToWarn:function(e,n){return c([e],n)},expectToWarnMany:c}},function(e,n){e.exports=require("@babel/runtime/helpers/toConsumableArray")},function(e,n){e.exports=require("relay-test-utils")}]);
|
9
|
+
module.exports=function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=3)}([function(e,n){e.exports=require("@babel/runtime/helpers/interopRequireDefault")},function(e,n,t){"use strict";var r=(0,t(0).default)(t(5)),o=console.error;e.exports={createConsoleInterceptionSystem:function(e,n,t){var i=!1,c=[],a=[],s=[],u=e.charAt(0).toUpperCase()+e.slice(1),l=u+"s",f="disallow".concat(u,"s");function p(e){var n=c.findIndex((function(n){return e.startsWith(n)})),t=a.findIndex((function(n){return e.startsWith(n)}));if(s.length>0&&e.startsWith(s[0]))s.shift();else if(n>=0)c.splice(n,1);else{if(!(t>=0))throw o("Unexpected ".concat(u,": ")+e),new Error("".concat(u,": ")+e);a.splice(t,1)}}function d(t,o){if(s.length>0)throw new Error("Cannot nest ".concat(n,"() calls."));s.push.apply(s,(0,r.default)(t));var i=o();if(s.length>0){var c=s.toString();throw s.length=0,new Error("Expected ".concat(e," in callback: ").concat(c))}return i}return{disallowMessages:function(){if(i)throw new Error("".concat(f," should be called only once."));i=!0,t(p),afterEach((function(){if(a.length=0,s.length=0,c.length>0){var n=new Error("Some ".concat(c.length," expected ").concat(e,"s where not triggered:\n\n")+Array.from(c,(function(e){return" * ".concat(e)})).join("\n")+"\n");throw c.length=0,n}}))},expectMessageWillFire:function(e,n){if(!i)throw new Error("".concat(f," needs to be called before expect").concat(l,"WillFire"));for(var t=!0===(null==n?void 0:n.optional),r=0;r<(null!==(o=null==n?void 0:n.count)&&void 0!==o?o:1);r++){var o;(t?a:c).push(e)}},expectMessage:function(e,n){return d([e],n)},expectMessageMany:d}}}},function(e,n){e.exports=require("relay-runtime")},function(e,n,t){"use strict";var r=t(4),o=r.disallowConsoleErrors,i=r.expectConsoleError,c=r.expectConsoleErrorsMany,a=r.expectConsoleErrorWillFire,s=t(6),u=s.disallowConsoleWarnings,l=s.expectConsoleWarning,f=s.expectConsoleWarningsMany,p=s.expectConsoleWarningWillFire,d=t(7),g=t(9),x=g.FIXTURE_TAG,h=g.generateTestsFromFixtures,y=t(14),v=t(16),w=t(18),b=t(19),m=t(20),W=m.disallowWarnings,E=m.expectToWarn,C=m.expectToWarnMany,M=m.expectWarningWillFire,F=t(21),j=F.createMockEnvironment,S=F.unwrapContainer;e.exports={cannotReadPropertyOfUndefined__DEPRECATED:function(e){return process.version.match(/^v16\.(.+)$/)?"Cannot read properties of undefined (reading '".concat(e,"')"):"Cannot read property '".concat(e,"' of undefined")},createMockEnvironment:j,describeWithFeatureFlags:d,disallowConsoleErrors:o,disallowConsoleWarnings:u,disallowWarnings:W,expectConsoleError:i,expectConsoleErrorsMany:c,expectConsoleErrorWillFire:a,expectConsoleWarningWillFire:p,expectConsoleWarning:l,expectConsoleWarningsMany:f,expectToWarn:E,expectToWarnMany:C,expectWarningWillFire:M,FIXTURE_TAG:x,generateTestsFromFixtures:h,matchers:y,printAST:v,simpleClone:w,trackRetentionForEnvironment:b,unwrapContainer:S}},function(e,n,t){"use strict";var r=(0,t(1).createConsoleInterceptionSystem)("error","expectConsoleError",(function(e){jest.spyOn(console,"error").mockImplementation(e)}));e.exports={disallowConsoleErrors:function(){r.disallowMessages()},expectConsoleErrorWillFire:function(e,n){r.expectMessageWillFire(e,n)},expectConsoleError:function(e,n){return r.expectMessage(e,n)},expectConsoleErrorsMany:function(e,n){return r.expectMessageMany(e,n)}}},function(e,n){e.exports=require("@babel/runtime/helpers/toConsumableArray")},function(e,n,t){"use strict";var r=(0,t(1).createConsoleInterceptionSystem)("warning","expectConsoleWarning",(function(e){jest.spyOn(console,"warn").mockImplementation(e)}));e.exports={disallowConsoleWarnings:function(){r.disallowMessages()},expectConsoleWarningWillFire:function(e,n){r.expectMessageWillFire(e,n)},expectConsoleWarning:function(e,n){return r.expectMessage(e,n)},expectConsoleWarningsMany:function(e,n){return r.expectMessageMany(e,n)}}},function(e,n,t){"use strict";var r=(0,t(0).default)(t(8));e.exports=function(e,n,o){describe.each(e)("".concat(n," - Feature flags: %o"),(function(e){var n;beforeEach((function(){var o=t(2).RelayFeatureFlags;n=(0,r.default)({},o),Object.assign(o,e)})),afterEach((function(){var e=t(2).RelayFeatureFlags;Object.assign(e,n)})),o()}))}},function(e,n){e.exports=require("@babel/runtime/helpers/objectSpread2")},function(e,n,t){"use strict";var r=(0,t(0).default)(t(10)),o=t(11),i=t(12),c=t(13),a=Symbol.for("FIXTURE_TAG");expect.addSnapshotSerializer({print:function(e){return Object.keys(e).map((function(n){return"~~~~~~~~~~ ".concat(n.toUpperCase()," ~~~~~~~~~~\n").concat(e[n])})).join("\n")},test:function(e){return e&&!0===e[a]}}),e.exports={generateTestsFromFixtures:function(e,n){var t=i.readdirSync(e);test("has fixtures in ".concat(e),(function(){expect(t.length>0).toBe(!0)}));var s=t.filter((function(e){return e.startsWith("only.")}));s.length&&(test.skip.each(t.filter((function(e){return!e.startsWith("only.")})))("matches expected output: %s",(function(){})),t=s),test.each(t)("matches expected output: %s",(function(t){var s,u=i.readFileSync(c.join(e,t),"utf8"),l=o(u,n,t);expect((s={},(0,r.default)(s,a,!0),(0,r.default)(s,"input",u),(0,r.default)(s,"output",l),s)).toMatchSnapshot()}))},FIXTURE_TAG:a}},function(e,n){e.exports=require("@babel/runtime/helpers/defineProperty")},function(e,n,t){"use strict";e.exports=function(e,n,t){if(/^# *expected-to-throw/.test(e)||/\.error\.\w+$/.test(t)){var r;try{r=n(e)}catch(e){return"THROWN EXCEPTION:\n\n".concat(e.toString())}throw new Error("Expected test file '".concat(t,"' to throw, but it passed:\n").concat(r))}return n(e)}},function(e,n){e.exports=require("fs")},function(e,n){e.exports=require("path")},function(e,n,t){"use strict";e.exports={toBeDeeplyFrozen:function(e){return function e(n){if(expect(Object.isFrozen(n)).toBe(!0),Array.isArray(n))n.forEach((function(n){return e(n)}));else if("object"==typeof n&&null!==n)for(var t in n)e(n[t])}(e),{pass:!0}},toWarn:function(e,n){var r=this.isNot;function o(e){return e instanceof RegExp?e.toString():JSON.stringify(e)}function i(e){return"["+e.map(o).join(", ")+"]"}function c(e){return e.length?e.map((function(e){return i([!!e[0]].concat(e.slice(1)))})).join(", "):"[]"}var a=t(15);if(!a.mock)throw new Error("toWarn(): Requires `jest.mock('warning')`.");var s=a.mock.calls.length;e();var u=a.mock.calls.slice(s);return n?(Array.isArray(n)||(n=[n]),{pass:!!u.find((function(e){return e.length===n.length+1&&e.every((function(e,t){if(!t)return!e;var r=n[t-1];return r instanceof RegExp?r.test(e):e===r}))})),message:function(){return"Expected ".concat(r?"not ":"","to warn: ")+"".concat(i([!1].concat(n))," but ")+"`warning` received the following calls: "+"".concat(c(u),".")}}):{pass:!!u.filter((function(e){return!e[0]})).length,message:function(){return"Expected ".concat(r?"not ":"","to warn but ")+"`warning` received the following calls: "+"".concat(c(u),".")}}}}},function(e,n){e.exports=require("fbjs/lib/warning")},function(e,n,t){"use strict";var r=(0,t(0).default)(t(17));e.exports=function(e){return function e(n,t){switch(typeof n){case"undefined":return"undefined";case"object":if(null===n)return"null";if(Array.isArray(n)){if(0===n.length)return"[]";var o,i="[\n",c=t+" ",a=(0,r.default)(n);try{for(a.s();!(o=a.n()).done;){var s=o.value;i+=c+e(s,c)+",\n"}}catch(e){a.e(e)}finally{a.f()}return i+=t+"]"}if("string"==typeof n.kind){for(var u="".concat(n.kind," {\n"),l=t+" ",f=0,p=Object.entries(n);f<p.length;f++){var d=p[f],g=d[0],x=d[1];"kind"!==g&&(u+="".concat(l).concat(g,": ").concat(e(x,l),",\n"))}return u+=t+"}"}if("function"==typeof n.toJSON)return e(n.toJSON(),t);for(var h="{\n",y=t+" ",v=0,w=Object.entries(n);v<w.length;v++){var b=w[v],m=b[0],W=b[1];h+="".concat(y).concat(JSON.stringify(m),": ").concat(e(W,y),",\n")}return h+=t+"}";case"string":case"number":case"boolean":return JSON.stringify(n,null,2).replace("\n","\n"+t);default:throw new Error("printAST doesn't handle values where "+"typeof value === '".concat(typeof n,"'."))}}(e,"")}},function(e,n){e.exports=require("@babel/runtime/helpers/createForOfIteratorHelper")},function(e,n,t){"use strict";e.exports=function e(n){if(Array.isArray(n))return n.map(e);if(null!=n&&"object"==typeof n){var t={};for(var r in n)t[r]=e(n[r]);return t}return n}},function(e,n,t){"use strict";e.exports=function(e){var n=new Map,t=jest.fn((function(e){var t,r=null!==(t=n.get(e))&&void 0!==t?t:NaN;1===r?n.delete(e):n.set(e,r-1)}));return e.retain=jest.fn((function(e){var r,o=e.request.identifier,i=null!==(r=n.get(o))&&void 0!==r?r:0;n.set(o,i+1);var c=!1;return{dispose:function(){c||t(o),c=!0}}})),{release_DEPRECATED:t,isOperationRetained:function(e){var t,r=e.request.identifier;return(null!==(t=n.get(r))&&void 0!==t?t:0)>0}}}},function(e,n,t){"use strict";var r=(0,t(1).createConsoleInterceptionSystem)("warning","expectToWarn",(function(e){jest.mock("fbjs/lib/warning",(function(){return jest.fn((function(n,t){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];if(!n){var c=0,a=t.replace(/%s/g,(function(){return String(o[c++])}));e(a)}}))}))}));e.exports={disallowWarnings:function(){r.disallowMessages()},expectWarningWillFire:function(e,n){r.expectMessageWillFire(e,n)},expectToWarn:function(e,n){return r.expectMessage(e,n)},expectToWarnMany:function(e,n){return r.expectMessageMany(e,n)}}},function(e,n){e.exports=require("relay-test-utils")}]);
|
package/simpleClone.js.flow
CHANGED
@@ -8,8 +8,6 @@
|
|
8
8
|
* @format
|
9
9
|
*/
|
10
10
|
|
11
|
-
// flowlint ambiguous-object-type:error
|
12
|
-
|
13
11
|
'use strict';
|
14
12
|
|
15
13
|
/**
|
@@ -22,7 +20,7 @@ function simpleClone<T>(value: T): T {
|
|
22
20
|
// $FlowFixMe[incompatible-return]
|
23
21
|
return value.map(simpleClone);
|
24
22
|
} else if (value != null && typeof value === 'object') {
|
25
|
-
const result = {};
|
23
|
+
const result: {[string]: mixed} = {};
|
26
24
|
for (const key in value) {
|
27
25
|
result[key] = simpleClone(value[key]);
|
28
26
|
}
|