relay-test-utils-internal 0.0.0-main-f0fc1eea → 0.0.0-main-c454f22f
Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,70 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) Facebook, Inc. and its 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
|
+
* @flow
|
8
|
+
* @format
|
9
|
+
*/
|
10
|
+
|
11
|
+
/**
|
12
|
+
* Run a test suite under multiple sets of feature flags.
|
13
|
+
* Beware that calling jest.resetModules() within the suite may break this.
|
14
|
+
*/
|
15
|
+
|
16
|
+
// flowlint ambiguous-object-type:error
|
17
|
+
|
18
|
+
'use strict';
|
19
|
+
|
20
|
+
import type {FeatureFlags} from '../relay-runtime/util/RelayFeatureFlags';
|
21
|
+
|
22
|
+
// This function is for running within a test environment, so we use globals
|
23
|
+
// available within tests -- taken from:
|
24
|
+
// i code/www/[5ee5e1d71a05e9f58ded3c1c22b810666383164f]/flow/shared/libdefs/jest.js
|
25
|
+
type JestDoneFn = {
|
26
|
+
(): void,
|
27
|
+
fail: (error: Error) => void,
|
28
|
+
...
|
29
|
+
};
|
30
|
+
declare function afterEach(
|
31
|
+
fn: (done: JestDoneFn) => ?Promise<mixed>,
|
32
|
+
timeout?: number,
|
33
|
+
): void;
|
34
|
+
declare function beforeEach(
|
35
|
+
fn: (done: JestDoneFn) => ?Promise<mixed>,
|
36
|
+
timeout?: number,
|
37
|
+
): void;
|
38
|
+
declare var describe: {
|
39
|
+
(name: JestTestName, fn: () => void): void,
|
40
|
+
each(
|
41
|
+
...table: $ReadOnlyArray<Array<mixed> | mixed> | [Array<string>, string]
|
42
|
+
): (
|
43
|
+
name: JestTestName,
|
44
|
+
fn?: (...args: Array<any>) => ?Promise<mixed>,
|
45
|
+
timeout?: number,
|
46
|
+
) => void,
|
47
|
+
...
|
48
|
+
};
|
49
|
+
|
50
|
+
function describeWithFeatureFlags(
|
51
|
+
flagSets: Array<$Shape<FeatureFlags>>,
|
52
|
+
description: string,
|
53
|
+
body: () => void,
|
54
|
+
): void {
|
55
|
+
describe.each(flagSets)(`${description} - Feature flags: %o`, flags => {
|
56
|
+
let originalFlags;
|
57
|
+
beforeEach(() => {
|
58
|
+
const {RelayFeatureFlags} = require('relay-runtime');
|
59
|
+
originalFlags = {...RelayFeatureFlags};
|
60
|
+
Object.assign(RelayFeatureFlags, flags);
|
61
|
+
});
|
62
|
+
afterEach(() => {
|
63
|
+
const {RelayFeatureFlags} = require('relay-runtime'); // re-import in case of jest module resets
|
64
|
+
Object.assign(RelayFeatureFlags, originalFlags);
|
65
|
+
});
|
66
|
+
body();
|
67
|
+
});
|
68
|
+
}
|
69
|
+
|
70
|
+
module.exports = describeWithFeatureFlags;
|
package/index.js
CHANGED
package/index.js.flow
CHANGED
@@ -12,6 +12,7 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
+
const describeWithFeatureFlags = require('./describeWithFeatureFlags');
|
15
16
|
const {
|
16
17
|
FIXTURE_TAG,
|
17
18
|
generateTestsFromFixtures,
|
@@ -47,6 +48,7 @@ function cannotReadPropertyOfUndefined__DEPRECATED(
|
|
47
48
|
module.exports = {
|
48
49
|
cannotReadPropertyOfUndefined__DEPRECATED,
|
49
50
|
createMockEnvironment,
|
51
|
+
describeWithFeatureFlags,
|
50
52
|
expectToWarn,
|
51
53
|
expectWarningWillFire,
|
52
54
|
disallowWarnings,
|
@@ -0,0 +1,46 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) Facebook, Inc. and its 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
|
+
|
11
|
+
/**
|
12
|
+
* Run a test suite under multiple sets of feature flags.
|
13
|
+
* Beware that calling jest.resetModules() within the suite may break this.
|
14
|
+
*/
|
15
|
+
// flowlint ambiguous-object-type:error
|
16
|
+
'use strict';
|
17
|
+
|
18
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
19
|
+
|
20
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
21
|
+
|
22
|
+
// This function is for running within a test environment, so we use globals
|
23
|
+
// available within tests -- taken from:
|
24
|
+
// i code/www/[5ee5e1d71a05e9f58ded3c1c22b810666383164f]/flow/shared/libdefs/jest.js
|
25
|
+
function describeWithFeatureFlags(flagSets, description, body) {
|
26
|
+
describe.each(flagSets)("".concat(description, " - Feature flags: %o"), function (flags) {
|
27
|
+
var originalFlags;
|
28
|
+
beforeEach(function () {
|
29
|
+
var _require = require('relay-runtime'),
|
30
|
+
RelayFeatureFlags = _require.RelayFeatureFlags;
|
31
|
+
|
32
|
+
originalFlags = (0, _objectSpread2["default"])({}, RelayFeatureFlags);
|
33
|
+
Object.assign(RelayFeatureFlags, flags);
|
34
|
+
});
|
35
|
+
afterEach(function () {
|
36
|
+
var _require2 = require('relay-runtime'),
|
37
|
+
RelayFeatureFlags = _require2.RelayFeatureFlags; // re-import in case of jest module resets
|
38
|
+
|
39
|
+
|
40
|
+
Object.assign(RelayFeatureFlags, originalFlags);
|
41
|
+
});
|
42
|
+
body();
|
43
|
+
});
|
44
|
+
}
|
45
|
+
|
46
|
+
module.exports = describeWithFeatureFlags;
|
package/lib/index.js
CHANGED
@@ -10,6 +10,8 @@
|
|
10
10
|
// flowlint ambiguous-object-type:error
|
11
11
|
'use strict';
|
12
12
|
|
13
|
+
var describeWithFeatureFlags = require('./describeWithFeatureFlags');
|
14
|
+
|
13
15
|
var _require = require('./generateTestsFromFixtures'),
|
14
16
|
FIXTURE_TAG = _require.FIXTURE_TAG,
|
15
17
|
generateTestsFromFixtures = _require.generateTestsFromFixtures;
|
@@ -49,6 +51,7 @@ function cannotReadPropertyOfUndefined__DEPRECATED(propertyName) {
|
|
49
51
|
module.exports = {
|
50
52
|
cannotReadPropertyOfUndefined__DEPRECATED: cannotReadPropertyOfUndefined__DEPRECATED,
|
51
53
|
createMockEnvironment: createMockEnvironment,
|
54
|
+
describeWithFeatureFlags: describeWithFeatureFlags,
|
52
55
|
expectToWarn: expectToWarn,
|
53
56
|
expectWarningWillFire: expectWarningWillFire,
|
54
57
|
disallowWarnings: disallowWarnings,
|
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": "0.0.0-main-
|
4
|
+
"version": "0.0.0-main-c454f22f",
|
5
5
|
"keywords": [
|
6
6
|
"graphql",
|
7
7
|
"relay"
|
@@ -13,7 +13,7 @@
|
|
13
13
|
"dependencies": {
|
14
14
|
"@babel/runtime": "^7.0.0",
|
15
15
|
"fbjs": "^3.0.0",
|
16
|
-
"relay-runtime": "0.0.0-main-
|
16
|
+
"relay-runtime": "0.0.0-main-c454f22f"
|
17
17
|
},
|
18
18
|
"directories": {
|
19
19
|
"": "./"
|
@@ -1,4 +1,4 @@
|
|
1
1
|
/**
|
2
|
-
* Relay v0.0.0-main-
|
2
|
+
* Relay v0.0.0-main-c454f22f
|
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=
|
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,c=o.generateTestsFromFixtures,a=t(10),u=t(12),s=t(14),f=t(15),l=f.disallowWarnings,p=f.expectToWarn,d=f.expectWarningWillFire,g=t(16),h=g.createMockEnvironment,x=g.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:h,describeWithFeatureFlags:r,expectToWarn:p,expectWarningWillFire:d,disallowWarnings:l,FIXTURE_TAG:i,generateTestsFromFixtures:c,matchers:a,printAST:u,simpleClone:s,unwrapContainer:x}},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),c=t(9),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 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(c.join(e,t),"utf8"),f=o(s,n,t);expect((u={},(0,r.default)(u,a,!0),(0,r.default)(u,"input",s),(0,r.default)(u,"output",f),u)).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(11);if(!a.mock)throw new Error("toWarn(): Requires `jest.mock('warning')`.");var u=a.mock.calls.length;e();var s=a.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(c(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(c(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",c=t+" ",a=(0,r.default)(n);try{for(a.s();!(o=a.n()).done;){var u=o.value;i+=c+e(u,c)+",\n"}}catch(e){a.e(e)}finally{a.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=!1,o=[],i=null;e.exports={disallowWarnings:function(){if(r)throw new Error("`disallowWarnings` should be called at most once");r=!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),c=2;c<t;c++)r[c-2]=arguments[c];if(!e){var a=0,u=n.replace(/%s/g,(function(){return String(r[a++])})),s=o.indexOf(u);if(null!=i&&i===u)i=null;else{if(!(s>=0))throw console.error("Unexpected Warning: "+u),new Error("Warning: "+u);o.splice(s,1)}}}))})),afterEach((function(){if(o.length>0){var e=new Error("Some expected warnings where not triggered:\n\n"+Array.from(o,(function(e){return" * ".concat(e)})).join("\n")+"\n");throw o.length=0,e}}))},expectWarningWillFire:function(e){if(!r)throw new Error("`disallowWarnings` needs to be called before `expectWarningWillFire`");o.push(e)},expectToWarn:function(e,n){if(null!=i)throw new Error("Cannot nest `expectToWarn()` calls.");i=e;var t=n();if(null!=i)throw i=null,new Error("Expected callback to warn: ".concat(e));return t}}},function(e,n){e.exports=require("relay-test-utils")}]);
|
@@ -1,9 +1,9 @@
|
|
1
1
|
/**
|
2
|
-
* Relay v0.0.0-main-
|
2
|
+
* Relay v0.0.0-main-c454f22f
|
3
3
|
*
|
4
4
|
* Copyright (c) Facebook, Inc. and its 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=
|
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,c=o.generateTestsFromFixtures,a=t(10),u=t(12),s=t(14),f=t(15),l=f.disallowWarnings,p=f.expectToWarn,d=f.expectWarningWillFire,g=t(16),h=g.createMockEnvironment,x=g.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:h,describeWithFeatureFlags:r,expectToWarn:p,expectWarningWillFire:d,disallowWarnings:l,FIXTURE_TAG:i,generateTestsFromFixtures:c,matchers:a,printAST:u,simpleClone:s,unwrapContainer:x}},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),c=t(9),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 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(c.join(e,t),"utf8"),f=o(s,n,t);expect((u={},(0,r.default)(u,a,!0),(0,r.default)(u,"input",s),(0,r.default)(u,"output",f),u)).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(11);if(!a.mock)throw new Error("toWarn(): Requires `jest.mock('warning')`.");var u=a.mock.calls.length;e();var s=a.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(c(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(c(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",c=t+" ",a=(0,r.default)(n);try{for(a.s();!(o=a.n()).done;){var u=o.value;i+=c+e(u,c)+",\n"}}catch(e){a.e(e)}finally{a.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=!1,o=[],i=null;e.exports={disallowWarnings:function(){if(r)throw new Error("`disallowWarnings` should be called at most once");r=!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),c=2;c<t;c++)r[c-2]=arguments[c];if(!e){var a=0,u=n.replace(/%s/g,(function(){return String(r[a++])})),s=o.indexOf(u);if(null!=i&&i===u)i=null;else{if(!(s>=0))throw console.error("Unexpected Warning: "+u),new Error("Warning: "+u);o.splice(s,1)}}}))})),afterEach((function(){if(o.length>0){var e=new Error("Some expected warnings where not triggered:\n\n"+Array.from(o,(function(e){return" * ".concat(e)})).join("\n")+"\n");throw o.length=0,e}}))},expectWarningWillFire:function(e){if(!r)throw new Error("`disallowWarnings` needs to be called before `expectWarningWillFire`");o.push(e)},expectToWarn:function(e,n){if(null!=i)throw new Error("Cannot nest `expectToWarn()` calls.");i=e;var t=n();if(null!=i)throw i=null,new Error("Expected callback to warn: ".concat(e));return t}}},function(e,n){e.exports=require("relay-test-utils")}]);
|