relay-test-utils-internal 14.0.0 → 15.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/Matchers.js.flow +1 -0
- package/consoleError.js.flow +1 -1
- package/consoleErrorsAndWarnings.js.flow +3 -3
- package/consoleWarning.js.flow +1 -1
- package/describeWithFeatureFlags.js.flow +2 -3
- package/generateTestsFromFixtures.js.flow +1 -0
- package/getOutputForFixture.js.flow +1 -2
- package/index.js +1 -1
- package/index.js.flow +1 -2
- package/lib/Matchers.js +7 -17
- package/lib/consoleError.js +8 -12
- package/lib/consoleErrorsAndWarnings.js +4 -22
- package/lib/consoleWarning.js +8 -12
- package/lib/describeWithFeatureFlags.js +6 -10
- package/lib/generateTestsFromFixtures.js +5 -12
- package/lib/getOutputForFixture.js +2 -5
- package/lib/index.js +21 -30
- package/lib/printAST.js +11 -28
- package/lib/simpleClone.js +5 -7
- package/lib/testschema.graphql +7 -27
- package/lib/trackRetentionForEnvironment.js +6 -11
- package/lib/warnings.js +8 -13
- package/package.json +2 -2
- package/printAST.js.flow +1 -2
- package/relay-test-utils-internal.js +2 -2
- package/relay-test-utils-internal.min.js +2 -2
- package/simpleClone.js.flow +1 -2
- package/trackRetentionForEnvironment.js.flow +6 -6
- package/warnings.js.flow +1 -1
package/Matchers.js.flow
CHANGED
package/consoleError.js.flow
CHANGED
@@ -4,9 +4,9 @@
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*
|
7
|
-
* @emails oncall+relay
|
8
7
|
* @flow strict-local
|
9
8
|
* @format
|
9
|
+
* @oncall relay
|
10
10
|
*/
|
11
11
|
|
12
12
|
'use strict';
|
@@ -18,12 +18,12 @@ export type WillFireOptions = {
|
|
18
18
|
optional?: boolean,
|
19
19
|
};
|
20
20
|
|
21
|
-
type API = $ReadOnly<{
|
21
|
+
type API = $ReadOnly<{
|
22
22
|
disallowMessages: () => void,
|
23
23
|
expectMessageWillFire: (string, void | WillFireOptions) => void,
|
24
24
|
expectMessage: <T>(string, () => T) => T,
|
25
25
|
expectMessageMany: <T>(Array<string>, () => T) => T,
|
26
|
-
|
26
|
+
}>;
|
27
27
|
|
28
28
|
const originalConsoleError = console.error;
|
29
29
|
|
package/consoleWarning.js.flow
CHANGED
@@ -6,6 +6,7 @@
|
|
6
6
|
*
|
7
7
|
* @flow
|
8
8
|
* @format
|
9
|
+
* @oncall relay
|
9
10
|
*/
|
10
11
|
|
11
12
|
/**
|
@@ -13,8 +14,6 @@
|
|
13
14
|
* Beware that calling jest.resetModules() within the suite may break this.
|
14
15
|
*/
|
15
16
|
|
16
|
-
// flowlint ambiguous-object-type:error
|
17
|
-
|
18
17
|
'use strict';
|
19
18
|
|
20
19
|
import type {FeatureFlags} from '../relay-runtime/util/RelayFeatureFlags';
|
@@ -48,7 +47,7 @@ declare var describe: {
|
|
48
47
|
};
|
49
48
|
|
50
49
|
function describeWithFeatureFlags(
|
51
|
-
flagSets: Array
|
50
|
+
flagSets: Array<Partial<FeatureFlags>>,
|
52
51
|
description: string,
|
53
52
|
body: () => void,
|
54
53
|
): void {
|
package/index.js
CHANGED
package/index.js.flow
CHANGED
package/lib/Matchers.js
CHANGED
@@ -5,14 +5,15 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*
|
7
7
|
* @format
|
8
|
+
* @oncall relay
|
8
9
|
*/
|
10
|
+
|
9
11
|
'use strict';
|
10
|
-
/* global expect */
|
11
12
|
|
13
|
+
/* global expect */
|
12
14
|
function toBeDeeplyFrozen(actual) {
|
13
15
|
function check(value) {
|
14
16
|
expect(Object.isFrozen(value)).toBe(true);
|
15
|
-
|
16
17
|
if (Array.isArray(value)) {
|
17
18
|
value.forEach(function (item) {
|
18
19
|
return check(item);
|
@@ -23,28 +24,22 @@ function toBeDeeplyFrozen(actual) {
|
|
23
24
|
}
|
24
25
|
}
|
25
26
|
}
|
26
|
-
|
27
27
|
check(actual);
|
28
28
|
return {
|
29
29
|
pass: true
|
30
30
|
};
|
31
31
|
}
|
32
|
-
|
33
32
|
function toWarn(actual, expected) {
|
34
33
|
var negative = this.isNot;
|
35
|
-
|
36
34
|
function formatItem(item) {
|
37
35
|
return item instanceof RegExp ? item.toString() : JSON.stringify(item);
|
38
36
|
}
|
39
|
-
|
40
37
|
function formatArray(array) {
|
41
38
|
return '[' + array.map(formatItem).join(', ') + ']';
|
42
39
|
}
|
43
|
-
|
44
40
|
function formatExpected(args) {
|
45
41
|
return formatArray([false].concat(args));
|
46
42
|
}
|
47
|
-
|
48
43
|
function formatActual(calls) {
|
49
44
|
if (calls.length) {
|
50
45
|
return calls.map(function (args) {
|
@@ -54,17 +49,15 @@ function toWarn(actual, expected) {
|
|
54
49
|
return '[]';
|
55
50
|
}
|
56
51
|
}
|
57
|
-
|
58
52
|
var warning = require("fbjs/lib/warning");
|
59
|
-
|
60
53
|
if (!warning.mock) {
|
61
54
|
throw new Error("toWarn(): Requires `jest.mock('warning')`.");
|
62
55
|
}
|
63
|
-
|
64
56
|
var callsCount = warning.mock.calls.length;
|
65
57
|
actual();
|
66
|
-
var calls = warning.mock.calls.slice(callsCount);
|
58
|
+
var calls = warning.mock.calls.slice(callsCount);
|
67
59
|
|
60
|
+
// Simple case: no explicit expectation.
|
68
61
|
if (!expected) {
|
69
62
|
var warned = calls.filter(function (args) {
|
70
63
|
return !args[0];
|
@@ -75,19 +68,17 @@ function toWarn(actual, expected) {
|
|
75
68
|
return "Expected ".concat(negative ? 'not ' : '', "to warn but ") + '`warning` received the following calls: ' + "".concat(formatActual(calls), ".");
|
76
69
|
}
|
77
70
|
};
|
78
|
-
}
|
79
|
-
|
71
|
+
}
|
80
72
|
|
73
|
+
// Custom case: explicit expectation.
|
81
74
|
if (!Array.isArray(expected)) {
|
82
75
|
expected = [expected];
|
83
76
|
}
|
84
|
-
|
85
77
|
var call = calls.find(function (args) {
|
86
78
|
return args.length === expected.length + 1 && args.every(function (arg, index) {
|
87
79
|
if (!index) {
|
88
80
|
return !arg;
|
89
81
|
}
|
90
|
-
|
91
82
|
var other = expected[index - 1];
|
92
83
|
return other instanceof RegExp ? other.test(arg) : arg === other;
|
93
84
|
});
|
@@ -99,7 +90,6 @@ function toWarn(actual, expected) {
|
|
99
90
|
}
|
100
91
|
};
|
101
92
|
}
|
102
|
-
|
103
93
|
module.exports = {
|
104
94
|
toBeDeeplyFrozen: toBeDeeplyFrozen,
|
105
95
|
toWarn: toWarn
|
package/lib/consoleError.js
CHANGED
@@ -4,19 +4,20 @@
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*
|
7
|
-
* @emails oncall+relay
|
8
7
|
*
|
9
8
|
* @format
|
9
|
+
* @oncall relay
|
10
10
|
*/
|
11
|
+
|
11
12
|
'use strict';
|
12
|
-
/* global jest */
|
13
13
|
|
14
|
+
/* global jest */
|
14
15
|
var _require = require('./consoleErrorsAndWarnings'),
|
15
|
-
|
16
|
-
|
16
|
+
createConsoleInterceptionSystem = _require.createConsoleInterceptionSystem;
|
17
17
|
var consoleErrorsSystem = createConsoleInterceptionSystem('error', 'expectConsoleError', function (impl) {
|
18
18
|
jest.spyOn(console, 'error').mockImplementation(impl);
|
19
19
|
});
|
20
|
+
|
20
21
|
/**
|
21
22
|
* Mocks console.error so that errors printed to the console are instead thrown.
|
22
23
|
* Any expected errors need to be explicitly expected with `expectConsoleErrorWillFire(message)`.
|
@@ -24,37 +25,32 @@ var consoleErrorsSystem = createConsoleInterceptionSystem('error', 'expectConsol
|
|
24
25
|
* NOTE: This should be called on top of a test file. The test should NOT
|
25
26
|
* use `jest.resetModules()` or manually mock `console`.
|
26
27
|
*/
|
27
|
-
|
28
28
|
function disallowConsoleErrors() {
|
29
29
|
consoleErrorsSystem.disallowMessages();
|
30
30
|
}
|
31
|
+
|
31
32
|
/**
|
32
33
|
* Expect an error with the given message. If the message isn't fired in the
|
33
34
|
* current test, the test will fail.
|
34
35
|
*/
|
35
|
-
|
36
|
-
|
37
36
|
function expectConsoleErrorWillFire(message, options) {
|
38
37
|
consoleErrorsSystem.expectMessageWillFire(message, options);
|
39
38
|
}
|
39
|
+
|
40
40
|
/**
|
41
41
|
* Expect the callback `fn` to print an error with the message, and otherwise fail.
|
42
42
|
*/
|
43
|
-
|
44
|
-
|
45
43
|
function expectConsoleError(message, fn) {
|
46
44
|
return consoleErrorsSystem.expectMessage(message, fn);
|
47
45
|
}
|
46
|
+
|
48
47
|
/**
|
49
48
|
* Expect the callback `fn` to trigger all console errors (in sequence),
|
50
49
|
* and otherwise fail.
|
51
50
|
*/
|
52
|
-
|
53
|
-
|
54
51
|
function expectConsoleErrorsMany(messages, fn) {
|
55
52
|
return consoleErrorsSystem.expectMessageMany(messages, fn);
|
56
53
|
}
|
57
|
-
|
58
54
|
module.exports = {
|
59
55
|
disallowConsoleErrors: disallowConsoleErrors,
|
60
56
|
expectConsoleErrorWillFire: expectConsoleErrorWillFire,
|
@@ -4,19 +4,17 @@
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*
|
7
|
-
* @emails oncall+relay
|
8
7
|
*
|
9
8
|
* @format
|
9
|
+
* @oncall relay
|
10
10
|
*/
|
11
|
-
'use strict';
|
12
|
-
/* global afterEach */
|
13
11
|
|
14
|
-
|
12
|
+
'use strict';
|
15
13
|
|
14
|
+
/* global afterEach */
|
15
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
16
16
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
17
|
-
|
18
17
|
var originalConsoleError = console.error;
|
19
|
-
|
20
18
|
function createConsoleInterceptionSystem(typename, expectFunctionName, setUpMock) {
|
21
19
|
var installed = false;
|
22
20
|
var expectedMessages = [];
|
@@ -25,7 +23,6 @@ function createConsoleInterceptionSystem(typename, expectFunctionName, setUpMock
|
|
25
23
|
var typenameCap = typename.charAt(0).toUpperCase() + typename.slice(1);
|
26
24
|
var typenameCapPlural = typenameCap + 's';
|
27
25
|
var installerName = "disallow".concat(typenameCap, "s");
|
28
|
-
|
29
26
|
function handleMessage(message) {
|
30
27
|
var index = expectedMessages.findIndex(function (expected) {
|
31
28
|
return message.startsWith(expected);
|
@@ -33,7 +30,6 @@ function createConsoleInterceptionSystem(typename, expectFunctionName, setUpMock
|
|
33
30
|
var optionalIndex = optionalMessages.findIndex(function (expected) {
|
34
31
|
return message.startsWith(expected);
|
35
32
|
});
|
36
|
-
|
37
33
|
if (contextualExpectedMessage.length > 0 && message.startsWith(contextualExpectedMessage[0])) {
|
38
34
|
contextualExpectedMessage.shift();
|
39
35
|
} else if (index >= 0) {
|
@@ -46,18 +42,15 @@ function createConsoleInterceptionSystem(typename, expectFunctionName, setUpMock
|
|
46
42
|
throw new Error("".concat(typenameCap, ": ") + message);
|
47
43
|
}
|
48
44
|
}
|
49
|
-
|
50
45
|
function disallowMessages() {
|
51
46
|
if (installed) {
|
52
47
|
throw new Error("".concat(installerName, " should be called only once."));
|
53
48
|
}
|
54
|
-
|
55
49
|
installed = true;
|
56
50
|
setUpMock(handleMessage);
|
57
51
|
afterEach(function () {
|
58
52
|
optionalMessages.length = 0;
|
59
53
|
contextualExpectedMessage.length = 0;
|
60
|
-
|
61
54
|
if (expectedMessages.length > 0) {
|
62
55
|
var error = new Error("Some ".concat(expectedMessages.length, " expected ").concat(typename, "s where not triggered:\n\n") + Array.from(expectedMessages, function (message) {
|
63
56
|
return " * ".concat(message);
|
@@ -67,42 +60,32 @@ function createConsoleInterceptionSystem(typename, expectFunctionName, setUpMock
|
|
67
60
|
}
|
68
61
|
});
|
69
62
|
}
|
70
|
-
|
71
63
|
function expectMessageWillFire(message, options) {
|
72
64
|
if (!installed) {
|
73
65
|
throw new Error("".concat(installerName, " needs to be called before expect").concat(typenameCapPlural, "WillFire"));
|
74
66
|
}
|
75
|
-
|
76
67
|
var optional = (options === null || options === void 0 ? void 0 : options.optional) === true; // avoid "sketchy null check"
|
77
|
-
|
78
68
|
for (var i = 0; i < ((_options$count = options === null || options === void 0 ? void 0 : options.count) !== null && _options$count !== void 0 ? _options$count : 1); i++) {
|
79
69
|
var _options$count;
|
80
|
-
|
81
70
|
(optional ? optionalMessages : expectedMessages).push(message);
|
82
71
|
}
|
83
72
|
}
|
84
|
-
|
85
73
|
function expectMessage(message, fn) {
|
86
74
|
return expectMessageMany([message], fn);
|
87
75
|
}
|
88
|
-
|
89
76
|
function expectMessageMany(messages, fn) {
|
90
77
|
if (contextualExpectedMessage.length > 0) {
|
91
78
|
throw new Error("Cannot nest ".concat(expectFunctionName, "() calls."));
|
92
79
|
}
|
93
|
-
|
94
80
|
contextualExpectedMessage.push.apply(contextualExpectedMessage, (0, _toConsumableArray2["default"])(messages));
|
95
81
|
var result = fn();
|
96
|
-
|
97
82
|
if (contextualExpectedMessage.length > 0) {
|
98
83
|
var notFired = contextualExpectedMessage.toString();
|
99
84
|
contextualExpectedMessage.length = 0;
|
100
85
|
throw new Error("Expected ".concat(typename, " in callback: ").concat(notFired));
|
101
86
|
}
|
102
|
-
|
103
87
|
return result;
|
104
88
|
}
|
105
|
-
|
106
89
|
return {
|
107
90
|
disallowMessages: disallowMessages,
|
108
91
|
expectMessageWillFire: expectMessageWillFire,
|
@@ -110,7 +93,6 @@ function createConsoleInterceptionSystem(typename, expectFunctionName, setUpMock
|
|
110
93
|
expectMessageMany: expectMessageMany
|
111
94
|
};
|
112
95
|
}
|
113
|
-
|
114
96
|
module.exports = {
|
115
97
|
createConsoleInterceptionSystem: createConsoleInterceptionSystem
|
116
98
|
};
|
package/lib/consoleWarning.js
CHANGED
@@ -4,19 +4,20 @@
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*
|
7
|
-
* @emails oncall+relay
|
8
7
|
*
|
9
8
|
* @format
|
9
|
+
* @oncall relay
|
10
10
|
*/
|
11
|
+
|
11
12
|
'use strict';
|
12
|
-
/* global jest */
|
13
13
|
|
14
|
+
/* global jest */
|
14
15
|
var _require = require('./consoleErrorsAndWarnings'),
|
15
|
-
|
16
|
-
|
16
|
+
createConsoleInterceptionSystem = _require.createConsoleInterceptionSystem;
|
17
17
|
var consoleWarningsSystem = createConsoleInterceptionSystem('warning', 'expectConsoleWarning', function (impl) {
|
18
18
|
jest.spyOn(console, 'warn').mockImplementation(impl);
|
19
19
|
});
|
20
|
+
|
20
21
|
/**
|
21
22
|
* Mocks console.warn so that warnings printed to the console are instead thrown.
|
22
23
|
* Any expected warnings need to be explicitly expected with `expectConsoleWarningWillFire(message)`.
|
@@ -24,37 +25,32 @@ var consoleWarningsSystem = createConsoleInterceptionSystem('warning', 'expectCo
|
|
24
25
|
* NOTE: This should be called on top of a test file. The test should NOT
|
25
26
|
* use `jest.resetModules()` or manually mock `console`.
|
26
27
|
*/
|
27
|
-
|
28
28
|
function disallowConsoleWarnings() {
|
29
29
|
consoleWarningsSystem.disallowMessages();
|
30
30
|
}
|
31
|
+
|
31
32
|
/**
|
32
33
|
* Expect a warning with the given message. If the message isn't fired in the
|
33
34
|
* current test, the test will fail.
|
34
35
|
*/
|
35
|
-
|
36
|
-
|
37
36
|
function expectConsoleWarningWillFire(message, options) {
|
38
37
|
consoleWarningsSystem.expectMessageWillFire(message, options);
|
39
38
|
}
|
39
|
+
|
40
40
|
/**
|
41
41
|
* Expect the callback `fn` to print a warning with the message, and otherwise fail.
|
42
42
|
*/
|
43
|
-
|
44
|
-
|
45
43
|
function expectConsoleWarning(message, fn) {
|
46
44
|
return consoleWarningsSystem.expectMessage(message, fn);
|
47
45
|
}
|
46
|
+
|
48
47
|
/**
|
49
48
|
* Expect the callback `fn` to trigger all console warnings (in sequence),
|
50
49
|
* and otherwise fail.
|
51
50
|
*/
|
52
|
-
|
53
|
-
|
54
51
|
function expectConsoleWarningsMany(messages, fn) {
|
55
52
|
return consoleWarningsSystem.expectMessageMany(messages, fn);
|
56
53
|
}
|
57
|
-
|
58
54
|
module.exports = {
|
59
55
|
disallowConsoleWarnings: disallowConsoleWarnings,
|
60
56
|
expectConsoleWarningWillFire: expectConsoleWarningWillFire,
|
@@ -6,41 +6,37 @@
|
|
6
6
|
*
|
7
7
|
*
|
8
8
|
* @format
|
9
|
+
* @oncall relay
|
9
10
|
*/
|
10
11
|
|
11
12
|
/**
|
12
13
|
* Run a test suite under multiple sets of feature flags.
|
13
14
|
* Beware that calling jest.resetModules() within the suite may break this.
|
14
15
|
*/
|
15
|
-
// flowlint ambiguous-object-type:error
|
16
|
-
'use strict';
|
17
16
|
|
18
|
-
|
17
|
+
'use strict';
|
19
18
|
|
19
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
20
20
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
21
|
-
|
22
21
|
// This function is for running within a test environment, so we use globals
|
23
22
|
// available within tests -- taken from:
|
24
23
|
// i code/www/[5ee5e1d71a05e9f58ded3c1c22b810666383164f]/flow/shared/libdefs/jest.js
|
24
|
+
|
25
25
|
function describeWithFeatureFlags(flagSets, description, body) {
|
26
26
|
describe.each(flagSets)("".concat(description, " - Feature flags: %o"), function (flags) {
|
27
27
|
var originalFlags;
|
28
28
|
beforeEach(function () {
|
29
29
|
var _require = require('relay-runtime'),
|
30
|
-
|
31
|
-
|
30
|
+
RelayFeatureFlags = _require.RelayFeatureFlags;
|
32
31
|
originalFlags = (0, _objectSpread2["default"])({}, RelayFeatureFlags);
|
33
32
|
Object.assign(RelayFeatureFlags, flags);
|
34
33
|
});
|
35
34
|
afterEach(function () {
|
36
35
|
var _require2 = require('relay-runtime'),
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
RelayFeatureFlags = _require2.RelayFeatureFlags; // re-import in case of jest module resets
|
40
37
|
Object.assign(RelayFeatureFlags, originalFlags);
|
41
38
|
});
|
42
39
|
body();
|
43
40
|
});
|
44
41
|
}
|
45
|
-
|
46
42
|
module.exports = describeWithFeatureFlags;
|
@@ -5,26 +5,23 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*
|
7
7
|
* @format
|
8
|
+
* @oncall relay
|
8
9
|
*/
|
9
|
-
'use strict';
|
10
10
|
|
11
|
-
|
11
|
+
'use strict';
|
12
12
|
|
13
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
13
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
14
|
-
|
15
15
|
var getOutputForFixture = require('./getOutputForFixture');
|
16
|
-
|
17
16
|
var fs = require('fs');
|
18
|
-
|
19
17
|
var path = require('path');
|
18
|
+
|
20
19
|
/* global expect,test */
|
21
20
|
|
22
21
|
/**
|
23
22
|
* Extend Jest with a custom snapshot serializer to provide additional context
|
24
23
|
* and reduce the amount of escaping that occurs.
|
25
24
|
*/
|
26
|
-
|
27
|
-
|
28
25
|
var FIXTURE_TAG = Symbol["for"]('FIXTURE_TAG');
|
29
26
|
expect.addSnapshotSerializer({
|
30
27
|
print: function print(value) {
|
@@ -36,13 +33,13 @@ expect.addSnapshotSerializer({
|
|
36
33
|
return value && value[FIXTURE_TAG] === true;
|
37
34
|
}
|
38
35
|
});
|
36
|
+
|
39
37
|
/**
|
40
38
|
* Generates a set of jest snapshot tests that compare the output of the
|
41
39
|
* provided `operation` to each of the matching files in the `fixturesPath`.
|
42
40
|
* The fixture should have '# expected-to-throw' on its first line
|
43
41
|
* if it is expected to fail
|
44
42
|
*/
|
45
|
-
|
46
43
|
function generateTestsFromFixtures(fixturesPath, operation) {
|
47
44
|
var fixtures = fs.readdirSync(fixturesPath);
|
48
45
|
test("has fixtures in ".concat(fixturesPath), function () {
|
@@ -51,23 +48,19 @@ function generateTestsFromFixtures(fixturesPath, operation) {
|
|
51
48
|
var onlyFixtures = fixtures.filter(function (name) {
|
52
49
|
return name.startsWith('only.');
|
53
50
|
});
|
54
|
-
|
55
51
|
if (onlyFixtures.length) {
|
56
52
|
test.skip.each(fixtures.filter(function (name) {
|
57
53
|
return !name.startsWith('only.');
|
58
54
|
}))('matches expected output: %s', function () {});
|
59
55
|
fixtures = onlyFixtures;
|
60
56
|
}
|
61
|
-
|
62
57
|
test.each(fixtures)('matches expected output: %s', function (file) {
|
63
58
|
var _expect;
|
64
|
-
|
65
59
|
var input = fs.readFileSync(path.join(fixturesPath, file), 'utf8');
|
66
60
|
var output = getOutputForFixture(input, operation, file);
|
67
61
|
expect((_expect = {}, (0, _defineProperty2["default"])(_expect, FIXTURE_TAG, true), (0, _defineProperty2["default"])(_expect, "input", input), (0, _defineProperty2["default"])(_expect, "output", output), _expect)).toMatchSnapshot();
|
68
62
|
});
|
69
63
|
}
|
70
|
-
|
71
64
|
module.exports = {
|
72
65
|
generateTestsFromFixtures: generateTestsFromFixtures,
|
73
66
|
FIXTURE_TAG: FIXTURE_TAG
|
@@ -6,26 +6,23 @@
|
|
6
6
|
*
|
7
7
|
*
|
8
8
|
* @format
|
9
|
+
* @oncall relay
|
9
10
|
*/
|
10
|
-
|
11
|
+
|
11
12
|
'use strict';
|
12
13
|
|
13
14
|
function getOutputForFixture(input, operation, file) {
|
14
15
|
var shouldThrow = /^# *expected-to-throw/.test(input) || /\.error\.\w+$/.test(file);
|
15
|
-
|
16
16
|
if (shouldThrow) {
|
17
17
|
var result;
|
18
|
-
|
19
18
|
try {
|
20
19
|
result = operation(input);
|
21
20
|
} catch (e) {
|
22
21
|
return "THROWN EXCEPTION:\n\n".concat(e.toString());
|
23
22
|
}
|
24
|
-
|
25
23
|
throw new Error("Expected test file '".concat(file, "' to throw, but it passed:\n").concat(result));
|
26
24
|
} else {
|
27
25
|
return operation(input);
|
28
26
|
}
|
29
27
|
}
|
30
|
-
|
31
28
|
module.exports = getOutputForFixture;
|
package/lib/index.js
CHANGED
@@ -6,51 +6,43 @@
|
|
6
6
|
*
|
7
7
|
*
|
8
8
|
* @format
|
9
|
+
* @oncall relay
|
9
10
|
*/
|
10
|
-
|
11
|
+
|
11
12
|
'use strict';
|
12
13
|
|
13
14
|
var _require = require('./consoleError'),
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
disallowConsoleErrors = _require.disallowConsoleErrors,
|
16
|
+
expectConsoleError = _require.expectConsoleError,
|
17
|
+
expectConsoleErrorsMany = _require.expectConsoleErrorsMany,
|
18
|
+
expectConsoleErrorWillFire = _require.expectConsoleErrorWillFire;
|
19
19
|
var _require2 = require('./consoleWarning'),
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
disallowConsoleWarnings = _require2.disallowConsoleWarnings,
|
21
|
+
expectConsoleWarning = _require2.expectConsoleWarning,
|
22
|
+
expectConsoleWarningsMany = _require2.expectConsoleWarningsMany,
|
23
|
+
expectConsoleWarningWillFire = _require2.expectConsoleWarningWillFire;
|
25
24
|
var describeWithFeatureFlags = require('./describeWithFeatureFlags');
|
26
|
-
|
27
25
|
var _require3 = require('./generateTestsFromFixtures'),
|
28
|
-
|
29
|
-
|
30
|
-
|
26
|
+
FIXTURE_TAG = _require3.FIXTURE_TAG,
|
27
|
+
generateTestsFromFixtures = _require3.generateTestsFromFixtures;
|
31
28
|
var Matchers = require('./Matchers');
|
32
|
-
|
33
29
|
var printAST = require('./printAST');
|
34
|
-
|
35
30
|
var simpleClone = require('./simpleClone');
|
36
|
-
|
37
31
|
var trackRetentionForEnvironment = require('./trackRetentionForEnvironment');
|
38
|
-
|
39
32
|
var _require4 = require('./warnings'),
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
33
|
+
disallowWarnings = _require4.disallowWarnings,
|
34
|
+
expectToWarn = _require4.expectToWarn,
|
35
|
+
expectToWarnMany = _require4.expectToWarnMany,
|
36
|
+
expectWarningWillFire = _require4.expectWarningWillFire;
|
45
37
|
var _require5 = require('relay-test-utils'),
|
46
|
-
|
47
|
-
|
38
|
+
createMockEnvironment = _require5.createMockEnvironment,
|
39
|
+
unwrapContainer = _require5.unwrapContainer;
|
40
|
+
|
41
|
+
// Apparently, in node v16 (because now they are using V8 V9.something)
|
48
42
|
// the content of the TypeError has changed, and now some of our tests
|
49
43
|
// stated to fail.
|
50
44
|
// This is a temporary work-around to make test pass, but we need to
|
51
45
|
// figure out a cleaner way of testing this.
|
52
|
-
|
53
|
-
|
54
46
|
function cannotReadPropertyOfUndefined__DEPRECATED(propertyName) {
|
55
47
|
if (process.version.match(/^v16\.(.+)$/)) {
|
56
48
|
return "Cannot read properties of undefined (reading '".concat(propertyName, "')");
|
@@ -58,11 +50,10 @@ function cannotReadPropertyOfUndefined__DEPRECATED(propertyName) {
|
|
58
50
|
return "Cannot read property '".concat(propertyName, "' of undefined");
|
59
51
|
}
|
60
52
|
}
|
53
|
+
|
61
54
|
/**
|
62
55
|
* The public interface to Relay Test Utils.
|
63
56
|
*/
|
64
|
-
|
65
|
-
|
66
57
|
module.exports = {
|
67
58
|
cannotReadPropertyOfUndefined__DEPRECATED: cannotReadPropertyOfUndefined__DEPRECATED,
|
68
59
|
createMockEnvironment: createMockEnvironment,
|
package/lib/printAST.js
CHANGED
@@ -6,9 +6,11 @@
|
|
6
6
|
*
|
7
7
|
*
|
8
8
|
* @format
|
9
|
+
* @oncall relay
|
9
10
|
*/
|
10
|
-
|
11
|
+
|
11
12
|
'use strict';
|
13
|
+
|
12
14
|
/**
|
13
15
|
* Prints a JSON AST similar to JSON.stringify(ast, null, 2) with some changes:
|
14
16
|
* - Adds trailing commas to simplify diffs.
|
@@ -19,20 +21,15 @@
|
|
19
21
|
* prop: value,
|
20
22
|
* }
|
21
23
|
*/
|
22
|
-
|
23
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
24
|
-
|
24
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
25
25
|
var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
|
26
|
-
|
27
26
|
function printAST(ast) {
|
28
27
|
return printASTImpl(ast, '');
|
29
28
|
}
|
30
|
-
|
31
29
|
function printASTImpl(ast, indent) {
|
32
30
|
switch (typeof ast) {
|
33
31
|
case 'undefined':
|
34
32
|
return 'undefined';
|
35
|
-
|
36
33
|
case 'object':
|
37
34
|
{
|
38
35
|
if (ast === null) {
|
@@ -41,13 +38,10 @@ function printASTImpl(ast, indent) {
|
|
41
38
|
if (ast.length === 0) {
|
42
39
|
return '[]';
|
43
40
|
}
|
44
|
-
|
45
41
|
var result = '[\n';
|
46
42
|
var itemIndent = indent + ' ';
|
47
|
-
|
48
43
|
var _iterator = (0, _createForOfIteratorHelper2["default"])(ast),
|
49
|
-
|
50
|
-
|
44
|
+
_step;
|
51
45
|
try {
|
52
46
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
53
47
|
var item = _step.value;
|
@@ -58,56 +52,45 @@ function printASTImpl(ast, indent) {
|
|
58
52
|
} finally {
|
59
53
|
_iterator.f();
|
60
54
|
}
|
61
|
-
|
62
55
|
result += indent + ']';
|
63
56
|
return result;
|
64
57
|
} else if (typeof ast.kind === 'string') {
|
65
58
|
var _result = "".concat(ast.kind, " {\n");
|
66
|
-
|
67
59
|
var keyIndent = indent + ' ';
|
68
|
-
|
69
60
|
for (var _i = 0, _Object$entries = Object.entries(ast); _i < _Object$entries.length; _i++) {
|
70
61
|
var _Object$entries$_i = _Object$entries[_i],
|
71
|
-
|
72
|
-
|
73
|
-
|
62
|
+
key = _Object$entries$_i[0],
|
63
|
+
value = _Object$entries$_i[1];
|
74
64
|
if (key === 'kind') {
|
75
65
|
continue;
|
76
66
|
}
|
77
|
-
|
78
67
|
_result += "".concat(keyIndent).concat(key, ": ").concat(printASTImpl(value, keyIndent), ",\n");
|
79
68
|
}
|
80
|
-
|
81
69
|
_result += indent + '}';
|
82
70
|
return _result;
|
83
71
|
} else if (typeof ast.toJSON === 'function') {
|
84
|
-
return printASTImpl(
|
72
|
+
return printASTImpl(
|
73
|
+
// $FlowFixMe[incompatible-use] - we have to unsafely assume no arguments here
|
85
74
|
ast.toJSON(), indent);
|
86
75
|
} else {
|
87
76
|
var _result2 = '{\n';
|
88
|
-
|
89
77
|
var _keyIndent = indent + ' ';
|
90
|
-
|
91
78
|
for (var _i2 = 0, _Object$entries2 = Object.entries(ast); _i2 < _Object$entries2.length; _i2++) {
|
92
79
|
var _Object$entries2$_i = _Object$entries2[_i2],
|
93
|
-
|
94
|
-
|
80
|
+
_key = _Object$entries2$_i[0],
|
81
|
+
_value = _Object$entries2$_i[1];
|
95
82
|
_result2 += "".concat(_keyIndent).concat(JSON.stringify(_key), ": ").concat(printASTImpl(_value, _keyIndent), ",\n");
|
96
83
|
}
|
97
|
-
|
98
84
|
_result2 += indent + '}';
|
99
85
|
return _result2;
|
100
86
|
}
|
101
87
|
}
|
102
|
-
|
103
88
|
case 'string':
|
104
89
|
case 'number':
|
105
90
|
case 'boolean':
|
106
91
|
return JSON.stringify(ast, null, 2).replace('\n', '\n' + indent);
|
107
|
-
|
108
92
|
default:
|
109
93
|
throw new Error("printAST doesn't handle values where " + "typeof value === '".concat(typeof ast, "'."));
|
110
94
|
}
|
111
95
|
}
|
112
|
-
|
113
96
|
module.exports = printAST;
|
package/lib/simpleClone.js
CHANGED
@@ -6,31 +6,29 @@
|
|
6
6
|
*
|
7
7
|
*
|
8
8
|
* @format
|
9
|
+
* @oncall relay
|
9
10
|
*/
|
10
|
-
|
11
|
+
|
11
12
|
'use strict';
|
13
|
+
|
12
14
|
/**
|
13
15
|
* A helper to create a deep clone of a value, plain Object, or array of such.
|
14
16
|
*
|
15
17
|
* Does not support RegExp, Date, other classes, or self-referential values.
|
16
18
|
*/
|
17
|
-
|
18
19
|
function simpleClone(value) {
|
19
20
|
if (Array.isArray(value)) {
|
20
21
|
// $FlowFixMe[incompatible-return]
|
21
22
|
return value.map(simpleClone);
|
22
23
|
} else if (value != null && typeof value === 'object') {
|
23
24
|
var result = {};
|
24
|
-
|
25
25
|
for (var key in value) {
|
26
26
|
result[key] = simpleClone(value[key]);
|
27
|
-
}
|
28
|
-
|
29
|
-
|
27
|
+
}
|
28
|
+
// $FlowFixMe[incompatible-return]
|
30
29
|
return result;
|
31
30
|
} else {
|
32
31
|
return value;
|
33
32
|
}
|
34
33
|
}
|
35
|
-
|
36
34
|
module.exports = simpleClone;
|
package/lib/testschema.graphql
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
1
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
2
2
|
|
3
3
|
schema {
|
4
4
|
query: Query
|
@@ -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
|
|
@@ -305,6 +306,7 @@ type Comment implements Node {
|
|
305
306
|
subscribeStatus: String
|
306
307
|
subscribers(first: Int): SubscribersConnection
|
307
308
|
topLevelComments(first: Int): TopLevelCommentsConnection
|
309
|
+
commentsFrom(name: String!): [CommentsEdge]
|
308
310
|
tracking: String
|
309
311
|
url(relative: Boolean, site: String): String
|
310
312
|
websites: [String]
|
@@ -1185,38 +1187,16 @@ type Settings {
|
|
1185
1187
|
|
1186
1188
|
type IDFieldTests {
|
1187
1189
|
id_non_null: IDFieldIsIDNonNull
|
1190
|
+
id_null: IDFieldIsIDNull
|
1188
1191
|
id: IDFieldIsID
|
1189
|
-
list_of_id: IDFieldIsListOfID
|
1190
|
-
string_non_null: IDFieldIsStringNonNull
|
1191
|
-
string: IDFieldIsString
|
1192
|
-
int_non_null: IDFieldIsIntNonNull
|
1193
|
-
int: IDFieldIsInt
|
1194
|
-
object: IDFieldIsObject
|
1195
1192
|
}
|
1193
|
+
scalar IDFieldIsID
|
1196
1194
|
type IDFieldIsIDNonNull {
|
1197
1195
|
id: ID!
|
1198
1196
|
}
|
1199
|
-
type
|
1197
|
+
type IDFieldIsIDNull {
|
1200
1198
|
id: ID
|
1201
1199
|
}
|
1202
|
-
type IDFieldIsListOfID {
|
1203
|
-
id: [ID]
|
1204
|
-
}
|
1205
|
-
type IDFieldIsStringNonNull {
|
1206
|
-
id: String!
|
1207
|
-
}
|
1208
|
-
type IDFieldIsString {
|
1209
|
-
id: String
|
1210
|
-
}
|
1211
|
-
type IDFieldIsIntNonNull {
|
1212
|
-
id: Int!
|
1213
|
-
}
|
1214
|
-
type IDFieldIsInt {
|
1215
|
-
id: Int
|
1216
|
-
}
|
1217
|
-
type IDFieldIsObject {
|
1218
|
-
id: Node
|
1219
|
-
}
|
1220
1200
|
|
1221
1201
|
scalar ReactFlightComponent
|
1222
1202
|
scalar ReactFlightProps
|
@@ -6,11 +6,12 @@
|
|
6
6
|
*
|
7
7
|
*
|
8
8
|
* @format
|
9
|
+
* @oncall relay
|
9
10
|
*/
|
10
|
-
|
11
|
+
|
11
12
|
'use strict';
|
12
|
-
/* global jest */
|
13
13
|
|
14
|
+
/* global jest */
|
14
15
|
/**
|
15
16
|
* Takes an environment and augments it with a mock implementation of `retain`
|
16
17
|
* that tracks what operations are currently retained. Also returns the Jest mock
|
@@ -21,19 +22,18 @@ function trackRetentionForEnvironment(environment) {
|
|
21
22
|
var retainCountsByOperation = new Map();
|
22
23
|
var release = jest.fn(function (id) {
|
23
24
|
var _retainCountsByOperat;
|
24
|
-
|
25
25
|
var existing = (_retainCountsByOperat = retainCountsByOperation.get(id)) !== null && _retainCountsByOperat !== void 0 ? _retainCountsByOperat : NaN;
|
26
|
-
|
27
26
|
if (existing === 1) {
|
28
27
|
retainCountsByOperation["delete"](id);
|
29
28
|
} else {
|
30
29
|
retainCountsByOperation.set(id, existing - 1);
|
31
30
|
}
|
32
|
-
});
|
31
|
+
});
|
33
32
|
|
33
|
+
// $FlowFixMe[cannot-write] safe to do for mocking
|
34
|
+
// $FlowFixMe[missing-local-annot] error found when enabling Flow LTI mode
|
34
35
|
environment.retain = jest.fn(function (operation) {
|
35
36
|
var _retainCountsByOperat2;
|
36
|
-
|
37
37
|
var id = operation.request.identifier;
|
38
38
|
var existing = (_retainCountsByOperat2 = retainCountsByOperation.get(id)) !== null && _retainCountsByOperat2 !== void 0 ? _retainCountsByOperat2 : 0;
|
39
39
|
retainCountsByOperation.set(id, existing + 1);
|
@@ -43,23 +43,18 @@ function trackRetentionForEnvironment(environment) {
|
|
43
43
|
if (!released) {
|
44
44
|
release(id);
|
45
45
|
}
|
46
|
-
|
47
46
|
released = true;
|
48
47
|
}
|
49
48
|
};
|
50
49
|
});
|
51
|
-
|
52
50
|
function isOperationRetained(operation) {
|
53
51
|
var _retainCountsByOperat3;
|
54
|
-
|
55
52
|
var id = operation.request.identifier;
|
56
53
|
return ((_retainCountsByOperat3 = retainCountsByOperation.get(id)) !== null && _retainCountsByOperat3 !== void 0 ? _retainCountsByOperat3 : 0) > 0;
|
57
54
|
}
|
58
|
-
|
59
55
|
return {
|
60
56
|
release_DEPRECATED: release,
|
61
57
|
isOperationRetained: isOperationRetained
|
62
58
|
};
|
63
59
|
}
|
64
|
-
|
65
60
|
module.exports = trackRetentionForEnvironment;
|
package/lib/warnings.js
CHANGED
@@ -4,23 +4,22 @@
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*
|
7
|
-
* @emails oncall+relay
|
8
7
|
*
|
9
8
|
* @format
|
9
|
+
* @oncall relay
|
10
10
|
*/
|
11
|
+
|
11
12
|
'use strict';
|
12
|
-
/* global jest */
|
13
13
|
|
14
|
+
/* global jest */
|
14
15
|
var _require = require('./consoleErrorsAndWarnings'),
|
15
|
-
|
16
|
-
|
16
|
+
createConsoleInterceptionSystem = _require.createConsoleInterceptionSystem;
|
17
17
|
var warningsSystem = createConsoleInterceptionSystem('warning', 'expectToWarn', function (impl) {
|
18
18
|
jest.mock("fbjs/lib/warning", function () {
|
19
19
|
return jest.fn(function (condition, format) {
|
20
20
|
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
21
21
|
args[_key - 2] = arguments[_key];
|
22
22
|
}
|
23
|
-
|
24
23
|
if (!condition) {
|
25
24
|
var argIndex = 0;
|
26
25
|
var message = format.replace(/%s/g, function () {
|
@@ -31,6 +30,7 @@ var warningsSystem = createConsoleInterceptionSystem('warning', 'expectToWarn',
|
|
31
30
|
});
|
32
31
|
});
|
33
32
|
});
|
33
|
+
|
34
34
|
/**
|
35
35
|
* Mocks the `warning` module to turn warnings into errors. Any expected
|
36
36
|
* warnings need to be explicitly expected with `expectWarningWillFire(message)`.
|
@@ -38,37 +38,32 @@ var warningsSystem = createConsoleInterceptionSystem('warning', 'expectToWarn',
|
|
38
38
|
* NOTE: This should be called on top of a test file. The test should NOT
|
39
39
|
* use `jest.resetModules()` or manually mock `warning`.
|
40
40
|
*/
|
41
|
-
|
42
41
|
function disallowWarnings() {
|
43
42
|
warningsSystem.disallowMessages();
|
44
43
|
}
|
44
|
+
|
45
45
|
/**
|
46
46
|
* Expect a warning with the given message. If the message isn't fired in the
|
47
47
|
* current test, the test will fail.
|
48
48
|
*/
|
49
|
-
|
50
|
-
|
51
49
|
function expectWarningWillFire(message, options) {
|
52
50
|
warningsSystem.expectMessageWillFire(message, options);
|
53
51
|
}
|
52
|
+
|
54
53
|
/**
|
55
54
|
* Expect the callback `fn` to trigger the warning message and otherwise fail.
|
56
55
|
*/
|
57
|
-
|
58
|
-
|
59
56
|
function expectToWarn(message, fn) {
|
60
57
|
return warningsSystem.expectMessage(message, fn);
|
61
58
|
}
|
59
|
+
|
62
60
|
/**
|
63
61
|
* Expect the callback `fn` to trigger all warning messages (in sequence)
|
64
62
|
* or otherwise fail.
|
65
63
|
*/
|
66
|
-
|
67
|
-
|
68
64
|
function expectToWarnMany(messages, fn) {
|
69
65
|
return warningsSystem.expectMessageMany(messages, fn);
|
70
66
|
}
|
71
|
-
|
72
67
|
module.exports = {
|
73
68
|
disallowWarnings: disallowWarnings,
|
74
69
|
expectWarningWillFire: expectWarningWillFire,
|
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": "15.0.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": "15.0.0"
|
21
21
|
},
|
22
22
|
"directories": {
|
23
23
|
"": "./"
|
package/printAST.js.flow
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
/**
|
2
|
-
* Relay
|
2
|
+
* Relay v15.0.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=3)}([function(e,n){e.exports=require("@babel/runtime/helpers/interopRequireDefault")},function(e,n,t){"use strict";var r=t(0)(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=t(0)(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=t(0)(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=t(0)(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")}]);
|
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 v15.0.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=3)}([function(e,n){e.exports=require("@babel/runtime/helpers/interopRequireDefault")},function(e,n,t){"use strict";var r=t(0)(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=t(0)(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=t(0)(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=t(0)(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")}]);
|
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
@@ -6,10 +6,9 @@
|
|
6
6
|
*
|
7
7
|
* @flow
|
8
8
|
* @format
|
9
|
+
* @oncall relay
|
9
10
|
*/
|
10
11
|
|
11
|
-
// flowlint ambiguous-object-type:error
|
12
|
-
|
13
12
|
'use strict';
|
14
13
|
|
15
14
|
/* global jest */
|
@@ -23,13 +22,13 @@ import type {OperationDescriptor} from '../relay-runtime/store/RelayStoreTypes';
|
|
23
22
|
* `release` function for backwards-compatibility with existing tests, but you
|
24
23
|
* should use `isOperationRetained` for new tests as it is much less error-prone.
|
25
24
|
*/
|
26
|
-
function trackRetentionForEnvironment(environment: IEnvironment): {
|
25
|
+
function trackRetentionForEnvironment(environment: IEnvironment): {
|
27
26
|
release_DEPRECATED: JestMockFn<[mixed], void>,
|
28
27
|
isOperationRetained: OperationDescriptor => boolean,
|
29
|
-
|
30
|
-
const retainCountsByOperation = new Map();
|
28
|
+
} {
|
29
|
+
const retainCountsByOperation = new Map<mixed, number>();
|
31
30
|
|
32
|
-
const release = jest.fn(id => {
|
31
|
+
const release = jest.fn((id: mixed) => {
|
33
32
|
const existing = retainCountsByOperation.get(id) ?? NaN;
|
34
33
|
if (existing === 1) {
|
35
34
|
retainCountsByOperation.delete(id);
|
@@ -39,6 +38,7 @@ function trackRetentionForEnvironment(environment: IEnvironment): {|
|
|
39
38
|
});
|
40
39
|
|
41
40
|
// $FlowFixMe[cannot-write] safe to do for mocking
|
41
|
+
// $FlowFixMe[missing-local-annot] error found when enabling Flow LTI mode
|
42
42
|
environment.retain = jest.fn(operation => {
|
43
43
|
const id = operation.request.identifier;
|
44
44
|
const existing = retainCountsByOperation.get(id) ?? 0;
|
package/warnings.js.flow
CHANGED