relay-test-utils-internal 0.0.0-main-0cfdd54d → 0.0.0-main-880c82c3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/consoleError.js.flow +42 -0
- package/index.js +1 -1
- package/index.js.flow +3 -1
- package/lib/consoleError.js +41 -0
- package/lib/index.js +16 -12
- package/package.json +2 -2
- package/relay-test-utils-internal.js +2 -2
- package/relay-test-utils-internal.min.js +2 -2
@@ -0,0 +1,42 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
|
+
*
|
4
|
+
* This source code is licensed under the MIT license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*
|
7
|
+
* @emails oncall+relay
|
8
|
+
* @flow strict-local
|
9
|
+
* @format
|
10
|
+
*/
|
11
|
+
|
12
|
+
'use strict';
|
13
|
+
|
14
|
+
/* global jest, afterEach */
|
15
|
+
|
16
|
+
let installed = false;
|
17
|
+
|
18
|
+
/**
|
19
|
+
* Similar to disallowWarnings.
|
20
|
+
* This method mocks the console.error and throws in the error is printed in the console.
|
21
|
+
*/
|
22
|
+
function disallowConsoleErrors(): void {
|
23
|
+
if (installed) {
|
24
|
+
throw new Error('`disallowConsoleErrors` should be called at most once');
|
25
|
+
}
|
26
|
+
installed = true;
|
27
|
+
let errors = [];
|
28
|
+
jest.spyOn(console, 'error').mockImplementation(message => {
|
29
|
+
errors.push(`Unexpected \`console.error\`:\n${message}.`);
|
30
|
+
});
|
31
|
+
afterEach(() => {
|
32
|
+
if (errors.length > 0) {
|
33
|
+
const message = errors.join('\n');
|
34
|
+
errors = [];
|
35
|
+
throw new Error(message);
|
36
|
+
}
|
37
|
+
});
|
38
|
+
}
|
39
|
+
|
40
|
+
module.exports = {
|
41
|
+
disallowConsoleErrors,
|
42
|
+
};
|
package/index.js
CHANGED
package/index.js.flow
CHANGED
@@ -12,6 +12,7 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
+
const {disallowConsoleErrors} = require('./consoleError');
|
15
16
|
const describeWithFeatureFlags = require('./describeWithFeatureFlags');
|
16
17
|
const {
|
17
18
|
FIXTURE_TAG,
|
@@ -50,10 +51,11 @@ module.exports = {
|
|
50
51
|
cannotReadPropertyOfUndefined__DEPRECATED,
|
51
52
|
createMockEnvironment,
|
52
53
|
describeWithFeatureFlags,
|
54
|
+
disallowConsoleErrors,
|
55
|
+
disallowWarnings,
|
53
56
|
expectToWarn,
|
54
57
|
expectToWarnMany,
|
55
58
|
expectWarningWillFire,
|
56
|
-
disallowWarnings,
|
57
59
|
FIXTURE_TAG,
|
58
60
|
generateTestsFromFixtures,
|
59
61
|
matchers: Matchers,
|
@@ -0,0 +1,41 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
|
+
*
|
4
|
+
* This source code is licensed under the MIT license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*
|
7
|
+
* @emails oncall+relay
|
8
|
+
*
|
9
|
+
* @format
|
10
|
+
*/
|
11
|
+
'use strict';
|
12
|
+
/* global jest, afterEach */
|
13
|
+
|
14
|
+
var installed = false;
|
15
|
+
/**
|
16
|
+
* Similar to disallowWarnings.
|
17
|
+
* This method mocks the console.error and throws in the error is printed in the console.
|
18
|
+
*/
|
19
|
+
|
20
|
+
function disallowConsoleErrors() {
|
21
|
+
if (installed) {
|
22
|
+
throw new Error('`disallowConsoleErrors` should be called at most once');
|
23
|
+
}
|
24
|
+
|
25
|
+
installed = true;
|
26
|
+
var errors = [];
|
27
|
+
jest.spyOn(console, 'error').mockImplementation(function (message) {
|
28
|
+
errors.push("Unexpected `console.error`:\n".concat(message, "."));
|
29
|
+
});
|
30
|
+
afterEach(function () {
|
31
|
+
if (errors.length > 0) {
|
32
|
+
var message = errors.join('\n');
|
33
|
+
errors = [];
|
34
|
+
throw new Error(message);
|
35
|
+
}
|
36
|
+
});
|
37
|
+
}
|
38
|
+
|
39
|
+
module.exports = {
|
40
|
+
disallowConsoleErrors: disallowConsoleErrors
|
41
|
+
};
|
package/lib/index.js
CHANGED
@@ -10,11 +10,14 @@
|
|
10
10
|
// flowlint ambiguous-object-type:error
|
11
11
|
'use strict';
|
12
12
|
|
13
|
+
var _require = require('./consoleError'),
|
14
|
+
disallowConsoleErrors = _require.disallowConsoleErrors;
|
15
|
+
|
13
16
|
var describeWithFeatureFlags = require('./describeWithFeatureFlags');
|
14
17
|
|
15
|
-
var
|
16
|
-
FIXTURE_TAG =
|
17
|
-
generateTestsFromFixtures =
|
18
|
+
var _require2 = require('./generateTestsFromFixtures'),
|
19
|
+
FIXTURE_TAG = _require2.FIXTURE_TAG,
|
20
|
+
generateTestsFromFixtures = _require2.generateTestsFromFixtures;
|
18
21
|
|
19
22
|
var Matchers = require('./Matchers');
|
20
23
|
|
@@ -22,15 +25,15 @@ var printAST = require('./printAST');
|
|
22
25
|
|
23
26
|
var simpleClone = require('./simpleClone');
|
24
27
|
|
25
|
-
var
|
26
|
-
disallowWarnings =
|
27
|
-
expectToWarn =
|
28
|
-
expectToWarnMany =
|
29
|
-
expectWarningWillFire =
|
28
|
+
var _require3 = require('./warnings'),
|
29
|
+
disallowWarnings = _require3.disallowWarnings,
|
30
|
+
expectToWarn = _require3.expectToWarn,
|
31
|
+
expectToWarnMany = _require3.expectToWarnMany,
|
32
|
+
expectWarningWillFire = _require3.expectWarningWillFire;
|
30
33
|
|
31
|
-
var
|
32
|
-
createMockEnvironment =
|
33
|
-
unwrapContainer =
|
34
|
+
var _require4 = require('relay-test-utils'),
|
35
|
+
createMockEnvironment = _require4.createMockEnvironment,
|
36
|
+
unwrapContainer = _require4.unwrapContainer; // Apparently, in node v16 (because now they are using V8 V9.something)
|
34
37
|
// the content of the TypeError has changed, and now some of our tests
|
35
38
|
// stated to fail.
|
36
39
|
// This is a temporary work-around to make test pass, but we need to
|
@@ -53,10 +56,11 @@ module.exports = {
|
|
53
56
|
cannotReadPropertyOfUndefined__DEPRECATED: cannotReadPropertyOfUndefined__DEPRECATED,
|
54
57
|
createMockEnvironment: createMockEnvironment,
|
55
58
|
describeWithFeatureFlags: describeWithFeatureFlags,
|
59
|
+
disallowConsoleErrors: disallowConsoleErrors,
|
60
|
+
disallowWarnings: disallowWarnings,
|
56
61
|
expectToWarn: expectToWarn,
|
57
62
|
expectToWarnMany: expectToWarnMany,
|
58
63
|
expectWarningWillFire: expectWarningWillFire,
|
59
|
-
disallowWarnings: disallowWarnings,
|
60
64
|
FIXTURE_TAG: FIXTURE_TAG,
|
61
65
|
generateTestsFromFixtures: generateTestsFromFixtures,
|
62
66
|
matchers: Matchers,
|
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-880c82c3",
|
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": "0.0.0-main-
|
20
|
+
"relay-runtime": "0.0.0-main-880c82c3"
|
21
21
|
},
|
22
22
|
"directories": {
|
23
23
|
"": "./"
|
@@ -1,4 +1,4 @@
|
|
1
1
|
/**
|
2
|
-
* Relay v0.0.0-main-
|
2
|
+
* Relay v0.0.0-main-880c82c3
|
3
3
|
*/
|
4
|
-
module.exports=function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=2)}([function(e,n){e.exports=require("@babel/runtime/helpers/interopRequireDefault")},function(e,n){e.exports=require("relay-runtime")},function(e,n,t){"use strict";var r=t(3),o=t(
|
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).disallowConsoleErrors,o=t(4),i=t(6),a=i.FIXTURE_TAG,c=i.generateTestsFromFixtures,u=t(11),s=t(13),f=t(15),l=t(16),p=l.disallowWarnings,d=l.expectToWarn,h=l.expectToWarnMany,g=l.expectWarningWillFire,x=t(18),y=x.createMockEnvironment,b=x.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:y,describeWithFeatureFlags:o,disallowConsoleErrors:r,disallowWarnings:p,expectToWarn:d,expectToWarnMany:h,expectWarningWillFire:g,FIXTURE_TAG:a,generateTestsFromFixtures:c,matchers:u,printAST:s,simpleClone:f,unwrapContainer:b}},function(e,n,t){"use strict";var r=!1;e.exports={disallowConsoleErrors:function(){if(r)throw new Error("`disallowConsoleErrors` should be called at most once");r=!0;var e=[];jest.spyOn(console,"error").mockImplementation((function(n){e.push("Unexpected `console.error`:\n".concat(n,"."))})),afterEach((function(){if(e.length>0){var n=e.join("\n");throw e=[],new Error(n)}}))}}},function(e,n,t){"use strict";var r=t(0)(t(5));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(7)),o=t(8),i=t(9),a=t(10),c=Symbol.for("FIXTURE_TAG");expect.addSnapshotSerializer({print:function(e){return Object.keys(e).map((function(n){return"~~~~~~~~~~ ".concat(n.toUpperCase()," ~~~~~~~~~~\n").concat(e[n])})).join("\n")},test:function(e){return e&&!0===e[c]}}),e.exports={generateTestsFromFixtures:function(e,n){var t=i.readdirSync(e);test("has fixtures in ".concat(e),(function(){expect(t.length>0).toBe(!0)}));var u=t.filter((function(e){return e.startsWith("only.")}));u.length&&(test.skip.each(t.filter((function(e){return!e.startsWith("only.")})))("matches expected output: %s",(function(){})),t=u),test.each(t)("matches expected output: %s",(function(t){var u,s=i.readFileSync(a.join(e,t),"utf8"),f=o(s,n,t);expect((u={},(0,r.default)(u,c,!0),(0,r.default)(u,"input",s),(0,r.default)(u,"output",f),u)).toMatchSnapshot()}))},FIXTURE_TAG:c}},function(e,n){e.exports=require("@babel/runtime/helpers/defineProperty")},function(e,n,t){"use strict";e.exports=function(e,n,t){if(/^# *expected-to-throw/.test(e)||/\.error\.\w+$/.test(t)){var r;try{r=n(e)}catch(e){return"THROWN EXCEPTION:\n\n".concat(e.toString())}throw new Error("Expected test file '".concat(t,"' to throw, but it passed:\n").concat(r))}return n(e)}},function(e,n){e.exports=require("fs")},function(e,n){e.exports=require("path")},function(e,n,t){"use strict";e.exports={toBeDeeplyFrozen:function(e){return function e(n){if(expect(Object.isFrozen(n)).toBe(!0),Array.isArray(n))n.forEach((function(n){return e(n)}));else if("object"==typeof n&&null!==n)for(var t in n)e(n[t])}(e),{pass:!0}},toWarn:function(e,n){var r=this.isNot;function o(e){return e instanceof RegExp?e.toString():JSON.stringify(e)}function i(e){return"["+e.map(o).join(", ")+"]"}function a(e){return e.length?e.map((function(e){return i([!!e[0]].concat(e.slice(1)))})).join(", "):"[]"}var c=t(12);if(!c.mock)throw new Error("toWarn(): Requires `jest.mock('warning')`.");var u=c.mock.calls.length;e();var s=c.mock.calls.slice(u);return n?(Array.isArray(n)||(n=[n]),{pass:!!s.find((function(e){return e.length===n.length+1&&e.every((function(e,t){if(!t)return!e;var r=n[t-1];return r instanceof RegExp?r.test(e):e===r}))})),message:function(){return"Expected ".concat(r?"not ":"","to warn: ")+"".concat(i([!1].concat(n))," but ")+"`warning` received the following calls: "+"".concat(a(s),".")}}):{pass:!!s.filter((function(e){return!e[0]})).length,message:function(){return"Expected ".concat(r?"not ":"","to warn but ")+"`warning` received the following calls: "+"".concat(a(s),".")}}}}},function(e,n){e.exports=require("fbjs/lib/warning")},function(e,n,t){"use strict";var r=t(0)(t(14));e.exports=function(e){return function e(n,t){switch(typeof n){case"undefined":return"undefined";case"object":if(null===n)return"null";if(Array.isArray(n)){if(0===n.length)return"[]";var o,i="[\n",a=t+" ",c=(0,r.default)(n);try{for(c.s();!(o=c.n()).done;){var u=o.value;i+=a+e(u,a)+",\n"}}catch(e){c.e(e)}finally{c.f()}return i+=t+"]"}if("string"==typeof n.kind){for(var s="".concat(n.kind," {\n"),f=t+" ",l=0,p=Object.entries(n);l<p.length;l++){var d=p[l],h=d[0],g=d[1];"kind"!==h&&(s+="".concat(f).concat(h,": ").concat(e(g,f),",\n"))}return s+=t+"}"}if("function"==typeof n.toJSON)return e(n.toJSON(),t);for(var x="{\n",y=t+" ",b=0,v=Object.entries(n);b<v.length;b++){var w=v[b],m=w[0],E=w[1];x+="".concat(y).concat(JSON.stringify(m),": ").concat(e(E,y),",\n")}return x+=t+"}";case"string":case"number":case"boolean":return JSON.stringify(n,null,2).replace("\n","\n"+t);default:throw new Error("printAST doesn't handle values where "+"typeof value === '".concat(typeof n,"'."))}}(e,"")}},function(e,n){e.exports=require("@babel/runtime/helpers/createForOfIteratorHelper")},function(e,n,t){"use strict";e.exports=function e(n){if(Array.isArray(n))return n.map(e);if(null!=n&&"object"==typeof n){var t={};for(var r in n)t[r]=e(n[r]);return t}return n}},function(e,n,t){"use strict";var r=t(0)(t(17)),o=!1,i=[],a=[];function c(e,n){if(a.length>0)throw new Error("Cannot nest `expectToWarn()` calls.");a.push.apply(a,(0,r.default)(e));var t=n();if(a.length>0){var o=a.toString();throw a.length=0,new Error("Expected callback to warn: ".concat(o))}return t}e.exports={disallowWarnings:function(){if(o)throw new Error("`disallowWarnings` should be called at most once");o=!0,jest.mock("fbjs/lib/warning",(function(){return jest.fn((function(e,n){for(var t=arguments.length,r=new Array(t>2?t-2:0),o=2;o<t;o++)r[o-2]=arguments[o];if(!e){var c=0,u=n.replace(/%s/g,(function(){return String(r[c++])})),s=i.indexOf(u);if(a.length>0&&a[0]===u)a.shift();else{if(!(s>=0))throw console.error("Unexpected Warning: "+u),new Error("Warning: "+u);i.splice(s,1)}}}))})),afterEach((function(){if(a.length=0,i.length>0){var e=new Error("Some expected warnings where not triggered:\n\n"+Array.from(i,(function(e){return" * ".concat(e)})).join("\n")+"\n");throw i.length=0,e}}))},expectWarningWillFire:function(e){if(!o)throw new Error("`disallowWarnings` needs to be called before `expectWarningWillFire`");i.push(e)},expectToWarn:function(e,n){return c([e],n)},expectToWarnMany:c}},function(e,n){e.exports=require("@babel/runtime/helpers/toConsumableArray")},function(e,n){e.exports=require("relay-test-utils")}]);
|
@@ -1,9 +1,9 @@
|
|
1
1
|
/**
|
2
|
-
* Relay v0.0.0-main-
|
2
|
+
* Relay v0.0.0-main-880c82c3
|
3
3
|
*
|
4
4
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
5
5
|
*
|
6
6
|
* This source code is licensed under the MIT license found in the
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
8
8
|
*/
|
9
|
-
module.exports=function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=2)}([function(e,n){e.exports=require("@babel/runtime/helpers/interopRequireDefault")},function(e,n){e.exports=require("relay-runtime")},function(e,n,t){"use strict";var r=t(3),o=t(
|
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).disallowConsoleErrors,o=t(4),i=t(6),a=i.FIXTURE_TAG,c=i.generateTestsFromFixtures,u=t(11),s=t(13),f=t(15),l=t(16),p=l.disallowWarnings,d=l.expectToWarn,h=l.expectToWarnMany,g=l.expectWarningWillFire,x=t(18),y=x.createMockEnvironment,b=x.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:y,describeWithFeatureFlags:o,disallowConsoleErrors:r,disallowWarnings:p,expectToWarn:d,expectToWarnMany:h,expectWarningWillFire:g,FIXTURE_TAG:a,generateTestsFromFixtures:c,matchers:u,printAST:s,simpleClone:f,unwrapContainer:b}},function(e,n,t){"use strict";var r=!1;e.exports={disallowConsoleErrors:function(){if(r)throw new Error("`disallowConsoleErrors` should be called at most once");r=!0;var e=[];jest.spyOn(console,"error").mockImplementation((function(n){e.push("Unexpected `console.error`:\n".concat(n,"."))})),afterEach((function(){if(e.length>0){var n=e.join("\n");throw e=[],new Error(n)}}))}}},function(e,n,t){"use strict";var r=t(0)(t(5));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(7)),o=t(8),i=t(9),a=t(10),c=Symbol.for("FIXTURE_TAG");expect.addSnapshotSerializer({print:function(e){return Object.keys(e).map((function(n){return"~~~~~~~~~~ ".concat(n.toUpperCase()," ~~~~~~~~~~\n").concat(e[n])})).join("\n")},test:function(e){return e&&!0===e[c]}}),e.exports={generateTestsFromFixtures:function(e,n){var t=i.readdirSync(e);test("has fixtures in ".concat(e),(function(){expect(t.length>0).toBe(!0)}));var u=t.filter((function(e){return e.startsWith("only.")}));u.length&&(test.skip.each(t.filter((function(e){return!e.startsWith("only.")})))("matches expected output: %s",(function(){})),t=u),test.each(t)("matches expected output: %s",(function(t){var u,s=i.readFileSync(a.join(e,t),"utf8"),f=o(s,n,t);expect((u={},(0,r.default)(u,c,!0),(0,r.default)(u,"input",s),(0,r.default)(u,"output",f),u)).toMatchSnapshot()}))},FIXTURE_TAG:c}},function(e,n){e.exports=require("@babel/runtime/helpers/defineProperty")},function(e,n,t){"use strict";e.exports=function(e,n,t){if(/^# *expected-to-throw/.test(e)||/\.error\.\w+$/.test(t)){var r;try{r=n(e)}catch(e){return"THROWN EXCEPTION:\n\n".concat(e.toString())}throw new Error("Expected test file '".concat(t,"' to throw, but it passed:\n").concat(r))}return n(e)}},function(e,n){e.exports=require("fs")},function(e,n){e.exports=require("path")},function(e,n,t){"use strict";e.exports={toBeDeeplyFrozen:function(e){return function e(n){if(expect(Object.isFrozen(n)).toBe(!0),Array.isArray(n))n.forEach((function(n){return e(n)}));else if("object"==typeof n&&null!==n)for(var t in n)e(n[t])}(e),{pass:!0}},toWarn:function(e,n){var r=this.isNot;function o(e){return e instanceof RegExp?e.toString():JSON.stringify(e)}function i(e){return"["+e.map(o).join(", ")+"]"}function a(e){return e.length?e.map((function(e){return i([!!e[0]].concat(e.slice(1)))})).join(", "):"[]"}var c=t(12);if(!c.mock)throw new Error("toWarn(): Requires `jest.mock('warning')`.");var u=c.mock.calls.length;e();var s=c.mock.calls.slice(u);return n?(Array.isArray(n)||(n=[n]),{pass:!!s.find((function(e){return e.length===n.length+1&&e.every((function(e,t){if(!t)return!e;var r=n[t-1];return r instanceof RegExp?r.test(e):e===r}))})),message:function(){return"Expected ".concat(r?"not ":"","to warn: ")+"".concat(i([!1].concat(n))," but ")+"`warning` received the following calls: "+"".concat(a(s),".")}}):{pass:!!s.filter((function(e){return!e[0]})).length,message:function(){return"Expected ".concat(r?"not ":"","to warn but ")+"`warning` received the following calls: "+"".concat(a(s),".")}}}}},function(e,n){e.exports=require("fbjs/lib/warning")},function(e,n,t){"use strict";var r=t(0)(t(14));e.exports=function(e){return function e(n,t){switch(typeof n){case"undefined":return"undefined";case"object":if(null===n)return"null";if(Array.isArray(n)){if(0===n.length)return"[]";var o,i="[\n",a=t+" ",c=(0,r.default)(n);try{for(c.s();!(o=c.n()).done;){var u=o.value;i+=a+e(u,a)+",\n"}}catch(e){c.e(e)}finally{c.f()}return i+=t+"]"}if("string"==typeof n.kind){for(var s="".concat(n.kind," {\n"),f=t+" ",l=0,p=Object.entries(n);l<p.length;l++){var d=p[l],h=d[0],g=d[1];"kind"!==h&&(s+="".concat(f).concat(h,": ").concat(e(g,f),",\n"))}return s+=t+"}"}if("function"==typeof n.toJSON)return e(n.toJSON(),t);for(var x="{\n",y=t+" ",b=0,v=Object.entries(n);b<v.length;b++){var w=v[b],m=w[0],E=w[1];x+="".concat(y).concat(JSON.stringify(m),": ").concat(e(E,y),",\n")}return x+=t+"}";case"string":case"number":case"boolean":return JSON.stringify(n,null,2).replace("\n","\n"+t);default:throw new Error("printAST doesn't handle values where "+"typeof value === '".concat(typeof n,"'."))}}(e,"")}},function(e,n){e.exports=require("@babel/runtime/helpers/createForOfIteratorHelper")},function(e,n,t){"use strict";e.exports=function e(n){if(Array.isArray(n))return n.map(e);if(null!=n&&"object"==typeof n){var t={};for(var r in n)t[r]=e(n[r]);return t}return n}},function(e,n,t){"use strict";var r=t(0)(t(17)),o=!1,i=[],a=[];function c(e,n){if(a.length>0)throw new Error("Cannot nest `expectToWarn()` calls.");a.push.apply(a,(0,r.default)(e));var t=n();if(a.length>0){var o=a.toString();throw a.length=0,new Error("Expected callback to warn: ".concat(o))}return t}e.exports={disallowWarnings:function(){if(o)throw new Error("`disallowWarnings` should be called at most once");o=!0,jest.mock("fbjs/lib/warning",(function(){return jest.fn((function(e,n){for(var t=arguments.length,r=new Array(t>2?t-2:0),o=2;o<t;o++)r[o-2]=arguments[o];if(!e){var c=0,u=n.replace(/%s/g,(function(){return String(r[c++])})),s=i.indexOf(u);if(a.length>0&&a[0]===u)a.shift();else{if(!(s>=0))throw console.error("Unexpected Warning: "+u),new Error("Warning: "+u);i.splice(s,1)}}}))})),afterEach((function(){if(a.length=0,i.length>0){var e=new Error("Some expected warnings where not triggered:\n\n"+Array.from(i,(function(e){return" * ".concat(e)})).join("\n")+"\n");throw i.length=0,e}}))},expectWarningWillFire:function(e){if(!o)throw new Error("`disallowWarnings` needs to be called before `expectWarningWillFire`");i.push(e)},expectToWarn:function(e,n){return c([e],n)},expectToWarnMany:c}},function(e,n){e.exports=require("@babel/runtime/helpers/toConsumableArray")},function(e,n){e.exports=require("relay-test-utils")}]);
|