Initial Sample.
This commit is contained in:
353
graphql-subscription/node_modules/@apollo/client/testing/core/core.cjs
generated
vendored
Normal file
353
graphql-subscription/node_modules/@apollo/client/testing/core/core.cjs
generated
vendored
Normal file
@@ -0,0 +1,353 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var tslib = require('tslib');
|
||||
var globals = require('../../utilities/globals');
|
||||
var equality = require('@wry/equality');
|
||||
var core = require('../../link/core');
|
||||
var utilities = require('../../utilities');
|
||||
var core$1 = require('../../core');
|
||||
var cache = require('../../cache');
|
||||
|
||||
function requestToKey(request, addTypename) {
|
||||
var queryString = request.query &&
|
||||
utilities.print(addTypename ? utilities.addTypenameToDocument(request.query) : request.query);
|
||||
var requestKey = { query: queryString };
|
||||
return JSON.stringify(requestKey);
|
||||
}
|
||||
var MockLink = (function (_super) {
|
||||
tslib.__extends(MockLink, _super);
|
||||
function MockLink(mockedResponses, addTypename, options) {
|
||||
if (addTypename === void 0) { addTypename = true; }
|
||||
if (options === void 0) { options = Object.create(null); }
|
||||
var _a;
|
||||
var _this = _super.call(this) || this;
|
||||
_this.addTypename = true;
|
||||
_this.showWarnings = true;
|
||||
_this.mockedResponsesByKey = {};
|
||||
_this.addTypename = addTypename;
|
||||
_this.showWarnings = (_a = options.showWarnings) !== null && _a !== void 0 ? _a : true;
|
||||
if (mockedResponses) {
|
||||
mockedResponses.forEach(function (mockedResponse) {
|
||||
_this.addMockedResponse(mockedResponse);
|
||||
});
|
||||
}
|
||||
return _this;
|
||||
}
|
||||
MockLink.prototype.addMockedResponse = function (mockedResponse) {
|
||||
var normalizedMockedResponse = this.normalizeMockedResponse(mockedResponse);
|
||||
var key = requestToKey(normalizedMockedResponse.request, this.addTypename);
|
||||
var mockedResponses = this.mockedResponsesByKey[key];
|
||||
if (!mockedResponses) {
|
||||
mockedResponses = [];
|
||||
this.mockedResponsesByKey[key] = mockedResponses;
|
||||
}
|
||||
mockedResponses.push(normalizedMockedResponse);
|
||||
};
|
||||
MockLink.prototype.request = function (operation) {
|
||||
var _this = this;
|
||||
var _a;
|
||||
this.operation = operation;
|
||||
var key = requestToKey(operation, this.addTypename);
|
||||
var unmatchedVars = [];
|
||||
var requestVariables = operation.variables || {};
|
||||
var mockedResponses = this.mockedResponsesByKey[key];
|
||||
var responseIndex = mockedResponses ?
|
||||
mockedResponses.findIndex(function (res, index) {
|
||||
var mockedResponseVars = res.request.variables || {};
|
||||
if (equality.equal(requestVariables, mockedResponseVars)) {
|
||||
return true;
|
||||
}
|
||||
if (res.variableMatcher && res.variableMatcher(operation.variables)) {
|
||||
return true;
|
||||
}
|
||||
unmatchedVars.push(mockedResponseVars);
|
||||
return false;
|
||||
})
|
||||
: -1;
|
||||
var response = responseIndex >= 0 ? mockedResponses[responseIndex] : void 0;
|
||||
var delay = (response === null || response === void 0 ? void 0 : response.delay) === Infinity ? 0 : (_a = response === null || response === void 0 ? void 0 : response.delay) !== null && _a !== void 0 ? _a : 0;
|
||||
var configError;
|
||||
if (!response) {
|
||||
configError = new Error("No more mocked responses for the query: ".concat(utilities.print(operation.query), "\nExpected variables: ").concat(utilities.stringifyForDisplay(operation.variables), "\n").concat(unmatchedVars.length > 0 ?
|
||||
"\nFailed to match ".concat(unmatchedVars.length, " mock").concat(unmatchedVars.length === 1 ? "" : "s", " for this query. The mocked response had the following variables:\n").concat(unmatchedVars.map(function (d) { return " ".concat(utilities.stringifyForDisplay(d)); }).join("\n"), "\n")
|
||||
: ""));
|
||||
if (this.showWarnings) {
|
||||
console.warn(configError.message +
|
||||
"\nThis typically indicates a configuration error in your mocks " +
|
||||
"setup, usually due to a typo or mismatched variable.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (response.maxUsageCount && response.maxUsageCount > 1) {
|
||||
response.maxUsageCount--;
|
||||
}
|
||||
else {
|
||||
mockedResponses.splice(responseIndex, 1);
|
||||
}
|
||||
var newData = response.newData;
|
||||
if (newData) {
|
||||
response.result = newData(operation.variables);
|
||||
mockedResponses.push(response);
|
||||
}
|
||||
if (!response.result && !response.error && response.delay !== Infinity) {
|
||||
configError = new Error("Mocked response should contain either `result`, `error` or a `delay` of `Infinity`: ".concat(key));
|
||||
}
|
||||
}
|
||||
return new utilities.Observable(function (observer) {
|
||||
var timer = setTimeout(function () {
|
||||
if (configError) {
|
||||
try {
|
||||
if (_this.onError(configError, observer) !== false) {
|
||||
throw configError;
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
observer.error(error);
|
||||
}
|
||||
}
|
||||
else if (response && response.delay !== Infinity) {
|
||||
if (response.error) {
|
||||
observer.error(response.error);
|
||||
}
|
||||
else {
|
||||
if (response.result) {
|
||||
observer.next(typeof response.result === "function" ?
|
||||
response.result(operation.variables)
|
||||
: response.result);
|
||||
}
|
||||
observer.complete();
|
||||
}
|
||||
}
|
||||
}, delay);
|
||||
return function () {
|
||||
clearTimeout(timer);
|
||||
};
|
||||
});
|
||||
};
|
||||
MockLink.prototype.normalizeMockedResponse = function (mockedResponse) {
|
||||
var _a;
|
||||
var newMockedResponse = utilities.cloneDeep(mockedResponse);
|
||||
var queryWithoutConnection = utilities.removeConnectionDirectiveFromDocument(newMockedResponse.request.query);
|
||||
globals.invariant(queryWithoutConnection, 64);
|
||||
newMockedResponse.request.query = queryWithoutConnection;
|
||||
var query = utilities.removeClientSetsFromDocument(newMockedResponse.request.query);
|
||||
if (query) {
|
||||
newMockedResponse.request.query = query;
|
||||
}
|
||||
mockedResponse.maxUsageCount = (_a = mockedResponse.maxUsageCount) !== null && _a !== void 0 ? _a : 1;
|
||||
globals.invariant(mockedResponse.maxUsageCount > 0, 65, mockedResponse.maxUsageCount);
|
||||
this.normalizeVariableMatching(newMockedResponse);
|
||||
return newMockedResponse;
|
||||
};
|
||||
MockLink.prototype.normalizeVariableMatching = function (mockedResponse) {
|
||||
var variables = mockedResponse.request.variables;
|
||||
if (mockedResponse.variableMatcher && variables) {
|
||||
throw new Error("Mocked response should contain either variableMatcher or request.variables");
|
||||
}
|
||||
if (!mockedResponse.variableMatcher) {
|
||||
mockedResponse.variableMatcher = function (vars) {
|
||||
var requestVariables = vars || {};
|
||||
var mockedResponseVariables = variables || {};
|
||||
return equality.equal(requestVariables, mockedResponseVariables);
|
||||
};
|
||||
}
|
||||
};
|
||||
return MockLink;
|
||||
}(core.ApolloLink));
|
||||
function mockSingleLink() {
|
||||
var mockedResponses = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
mockedResponses[_i] = arguments[_i];
|
||||
}
|
||||
var maybeTypename = mockedResponses[mockedResponses.length - 1];
|
||||
var mocks = mockedResponses.slice(0, mockedResponses.length - 1);
|
||||
if (typeof maybeTypename !== "boolean") {
|
||||
mocks = mockedResponses;
|
||||
maybeTypename = true;
|
||||
}
|
||||
return new MockLink(mocks, maybeTypename);
|
||||
}
|
||||
|
||||
var MockSubscriptionLink = (function (_super) {
|
||||
tslib.__extends(MockSubscriptionLink, _super);
|
||||
function MockSubscriptionLink() {
|
||||
var _this = _super.call(this) || this;
|
||||
_this.unsubscribers = [];
|
||||
_this.setups = [];
|
||||
_this.observers = [];
|
||||
return _this;
|
||||
}
|
||||
MockSubscriptionLink.prototype.request = function (operation) {
|
||||
var _this = this;
|
||||
this.operation = operation;
|
||||
return new utilities.Observable(function (observer) {
|
||||
_this.setups.forEach(function (x) { return x(); });
|
||||
_this.observers.push(observer);
|
||||
return function () {
|
||||
_this.unsubscribers.forEach(function (x) { return x(); });
|
||||
};
|
||||
});
|
||||
};
|
||||
MockSubscriptionLink.prototype.simulateResult = function (result, complete) {
|
||||
var _this = this;
|
||||
if (complete === void 0) { complete = false; }
|
||||
setTimeout(function () {
|
||||
var observers = _this.observers;
|
||||
if (!observers.length)
|
||||
throw new Error("subscription torn down");
|
||||
observers.forEach(function (observer) {
|
||||
if (result.result && observer.next)
|
||||
observer.next(result.result);
|
||||
if (result.error && observer.error)
|
||||
observer.error(result.error);
|
||||
if (complete && observer.complete)
|
||||
observer.complete();
|
||||
});
|
||||
}, result.delay || 0);
|
||||
};
|
||||
MockSubscriptionLink.prototype.simulateComplete = function () {
|
||||
var observers = this.observers;
|
||||
if (!observers.length)
|
||||
throw new Error("subscription torn down");
|
||||
observers.forEach(function (observer) {
|
||||
if (observer.complete)
|
||||
observer.complete();
|
||||
});
|
||||
};
|
||||
MockSubscriptionLink.prototype.onSetup = function (listener) {
|
||||
this.setups = this.setups.concat([listener]);
|
||||
};
|
||||
MockSubscriptionLink.prototype.onUnsubscribe = function (listener) {
|
||||
this.unsubscribers = this.unsubscribers.concat([listener]);
|
||||
};
|
||||
return MockSubscriptionLink;
|
||||
}(core.ApolloLink));
|
||||
function mockObservableLink() {
|
||||
return new MockSubscriptionLink();
|
||||
}
|
||||
|
||||
function createMockClient(data, query, variables) {
|
||||
if (variables === void 0) { variables = {}; }
|
||||
return new core$1.ApolloClient({
|
||||
link: mockSingleLink({
|
||||
request: { query: query, variables: variables },
|
||||
result: { data: data },
|
||||
}).setOnError(function (error) {
|
||||
throw error;
|
||||
}),
|
||||
cache: new cache.InMemoryCache({ addTypename: false }),
|
||||
});
|
||||
}
|
||||
|
||||
function subscribeAndCount(reject, observable, cb) {
|
||||
var queue = Promise.resolve();
|
||||
var handleCount = 0;
|
||||
var subscription = utilities.asyncMap(observable, function (result) {
|
||||
return (queue = queue
|
||||
.then(function () {
|
||||
return cb(++handleCount, result);
|
||||
})
|
||||
.catch(error));
|
||||
}).subscribe({ error: error });
|
||||
function error(e) {
|
||||
subscription.unsubscribe();
|
||||
reject(e);
|
||||
}
|
||||
return subscription;
|
||||
}
|
||||
|
||||
function wrap(key) {
|
||||
return function (message, callback, timeout) {
|
||||
return (key ? it[key] : it)(message, function () {
|
||||
var _this = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
return callback.call(_this, resolve, reject);
|
||||
});
|
||||
}, timeout);
|
||||
};
|
||||
}
|
||||
var wrappedIt = wrap();
|
||||
var itAsync = Object.assign(function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
return wrappedIt.apply(this, args);
|
||||
}, {
|
||||
only: wrap("only"),
|
||||
skip: wrap("skip"),
|
||||
todo: wrap("todo"),
|
||||
});
|
||||
|
||||
function wait(ms) {
|
||||
return tslib.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib.__generator(this, function (_a) {
|
||||
return [2 , new Promise(function (resolve) { return setTimeout(resolve, ms); })];
|
||||
});
|
||||
});
|
||||
}
|
||||
function tick() {
|
||||
return tslib.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib.__generator(this, function (_a) {
|
||||
return [2 , wait(0)];
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function wrapTestFunction(fn, consoleMethodName) {
|
||||
return function () {
|
||||
var _this = this;
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
var spy = jest.spyOn(console, consoleMethodName);
|
||||
spy.mockImplementation(function () { });
|
||||
return new Promise(function (resolve) {
|
||||
resolve(fn === null || fn === void 0 ? void 0 : fn.apply(_this, args));
|
||||
}).finally(function () {
|
||||
expect(spy).toMatchSnapshot();
|
||||
spy.mockReset();
|
||||
});
|
||||
};
|
||||
}
|
||||
function withErrorSpy(it) {
|
||||
var args = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
args[_i - 1] = arguments[_i];
|
||||
}
|
||||
args[1] = wrapTestFunction(args[1], "error");
|
||||
return it.apply(void 0, args);
|
||||
}
|
||||
function withWarningSpy(it) {
|
||||
var args = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
args[_i - 1] = arguments[_i];
|
||||
}
|
||||
args[1] = wrapTestFunction(args[1], "warn");
|
||||
return it.apply(void 0, args);
|
||||
}
|
||||
function withLogSpy(it) {
|
||||
var args = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
args[_i - 1] = arguments[_i];
|
||||
}
|
||||
args[1] = wrapTestFunction(args[1], "log");
|
||||
return it.apply(void 0, args);
|
||||
}
|
||||
|
||||
exports.MockLink = MockLink;
|
||||
exports.MockSubscriptionLink = MockSubscriptionLink;
|
||||
exports.createMockClient = createMockClient;
|
||||
exports.itAsync = itAsync;
|
||||
exports.mockObservableLink = mockObservableLink;
|
||||
exports.mockSingleLink = mockSingleLink;
|
||||
exports.subscribeAndCount = subscribeAndCount;
|
||||
exports.tick = tick;
|
||||
exports.wait = wait;
|
||||
exports.withErrorSpy = withErrorSpy;
|
||||
exports.withLogSpy = withLogSpy;
|
||||
exports.withWarningSpy = withWarningSpy;
|
||||
//# sourceMappingURL=core.cjs.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/core/core.cjs.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/core/core.cjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
353
graphql-subscription/node_modules/@apollo/client/testing/core/core.cjs.native.js
generated
vendored
Normal file
353
graphql-subscription/node_modules/@apollo/client/testing/core/core.cjs.native.js
generated
vendored
Normal file
@@ -0,0 +1,353 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var tslib = require('tslib');
|
||||
var globals = require('../../utilities/globals');
|
||||
var equality = require('@wry/equality');
|
||||
var core = require('../../link/core');
|
||||
var utilities = require('../../utilities');
|
||||
var core$1 = require('../../core');
|
||||
var cache = require('../../cache');
|
||||
|
||||
function requestToKey(request, addTypename) {
|
||||
var queryString = request.query &&
|
||||
utilities.print(addTypename ? utilities.addTypenameToDocument(request.query) : request.query);
|
||||
var requestKey = { query: queryString };
|
||||
return JSON.stringify(requestKey);
|
||||
}
|
||||
var MockLink = (function (_super) {
|
||||
tslib.__extends(MockLink, _super);
|
||||
function MockLink(mockedResponses, addTypename, options) {
|
||||
if (addTypename === void 0) { addTypename = true; }
|
||||
if (options === void 0) { options = Object.create(null); }
|
||||
var _a;
|
||||
var _this = _super.call(this) || this;
|
||||
_this.addTypename = true;
|
||||
_this.showWarnings = true;
|
||||
_this.mockedResponsesByKey = {};
|
||||
_this.addTypename = addTypename;
|
||||
_this.showWarnings = (_a = options.showWarnings) !== null && _a !== void 0 ? _a : true;
|
||||
if (mockedResponses) {
|
||||
mockedResponses.forEach(function (mockedResponse) {
|
||||
_this.addMockedResponse(mockedResponse);
|
||||
});
|
||||
}
|
||||
return _this;
|
||||
}
|
||||
MockLink.prototype.addMockedResponse = function (mockedResponse) {
|
||||
var normalizedMockedResponse = this.normalizeMockedResponse(mockedResponse);
|
||||
var key = requestToKey(normalizedMockedResponse.request, this.addTypename);
|
||||
var mockedResponses = this.mockedResponsesByKey[key];
|
||||
if (!mockedResponses) {
|
||||
mockedResponses = [];
|
||||
this.mockedResponsesByKey[key] = mockedResponses;
|
||||
}
|
||||
mockedResponses.push(normalizedMockedResponse);
|
||||
};
|
||||
MockLink.prototype.request = function (operation) {
|
||||
var _this = this;
|
||||
var _a;
|
||||
this.operation = operation;
|
||||
var key = requestToKey(operation, this.addTypename);
|
||||
var unmatchedVars = [];
|
||||
var requestVariables = operation.variables || {};
|
||||
var mockedResponses = this.mockedResponsesByKey[key];
|
||||
var responseIndex = mockedResponses ?
|
||||
mockedResponses.findIndex(function (res, index) {
|
||||
var mockedResponseVars = res.request.variables || {};
|
||||
if (equality.equal(requestVariables, mockedResponseVars)) {
|
||||
return true;
|
||||
}
|
||||
if (res.variableMatcher && res.variableMatcher(operation.variables)) {
|
||||
return true;
|
||||
}
|
||||
unmatchedVars.push(mockedResponseVars);
|
||||
return false;
|
||||
})
|
||||
: -1;
|
||||
var response = responseIndex >= 0 ? mockedResponses[responseIndex] : void 0;
|
||||
var delay = (response === null || response === void 0 ? void 0 : response.delay) === Infinity ? 0 : (_a = response === null || response === void 0 ? void 0 : response.delay) !== null && _a !== void 0 ? _a : 0;
|
||||
var configError;
|
||||
if (!response) {
|
||||
configError = new Error("No more mocked responses for the query: ".concat(utilities.print(operation.query), "\nExpected variables: ").concat(utilities.stringifyForDisplay(operation.variables), "\n").concat(unmatchedVars.length > 0 ?
|
||||
"\nFailed to match ".concat(unmatchedVars.length, " mock").concat(unmatchedVars.length === 1 ? "" : "s", " for this query. The mocked response had the following variables:\n").concat(unmatchedVars.map(function (d) { return " ".concat(utilities.stringifyForDisplay(d)); }).join("\n"), "\n")
|
||||
: ""));
|
||||
if (this.showWarnings) {
|
||||
console.warn(configError.message +
|
||||
"\nThis typically indicates a configuration error in your mocks " +
|
||||
"setup, usually due to a typo or mismatched variable.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (response.maxUsageCount && response.maxUsageCount > 1) {
|
||||
response.maxUsageCount--;
|
||||
}
|
||||
else {
|
||||
mockedResponses.splice(responseIndex, 1);
|
||||
}
|
||||
var newData = response.newData;
|
||||
if (newData) {
|
||||
response.result = newData(operation.variables);
|
||||
mockedResponses.push(response);
|
||||
}
|
||||
if (!response.result && !response.error && response.delay !== Infinity) {
|
||||
configError = new Error("Mocked response should contain either `result`, `error` or a `delay` of `Infinity`: ".concat(key));
|
||||
}
|
||||
}
|
||||
return new utilities.Observable(function (observer) {
|
||||
var timer = setTimeout(function () {
|
||||
if (configError) {
|
||||
try {
|
||||
if (_this.onError(configError, observer) !== false) {
|
||||
throw configError;
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
observer.error(error);
|
||||
}
|
||||
}
|
||||
else if (response && response.delay !== Infinity) {
|
||||
if (response.error) {
|
||||
observer.error(response.error);
|
||||
}
|
||||
else {
|
||||
if (response.result) {
|
||||
observer.next(typeof response.result === "function" ?
|
||||
response.result(operation.variables)
|
||||
: response.result);
|
||||
}
|
||||
observer.complete();
|
||||
}
|
||||
}
|
||||
}, delay);
|
||||
return function () {
|
||||
clearTimeout(timer);
|
||||
};
|
||||
});
|
||||
};
|
||||
MockLink.prototype.normalizeMockedResponse = function (mockedResponse) {
|
||||
var _a;
|
||||
var newMockedResponse = utilities.cloneDeep(mockedResponse);
|
||||
var queryWithoutConnection = utilities.removeConnectionDirectiveFromDocument(newMockedResponse.request.query);
|
||||
globals.invariant(queryWithoutConnection, 64);
|
||||
newMockedResponse.request.query = queryWithoutConnection;
|
||||
var query = utilities.removeClientSetsFromDocument(newMockedResponse.request.query);
|
||||
if (query) {
|
||||
newMockedResponse.request.query = query;
|
||||
}
|
||||
mockedResponse.maxUsageCount = (_a = mockedResponse.maxUsageCount) !== null && _a !== void 0 ? _a : 1;
|
||||
globals.invariant(mockedResponse.maxUsageCount > 0, 65, mockedResponse.maxUsageCount);
|
||||
this.normalizeVariableMatching(newMockedResponse);
|
||||
return newMockedResponse;
|
||||
};
|
||||
MockLink.prototype.normalizeVariableMatching = function (mockedResponse) {
|
||||
var variables = mockedResponse.request.variables;
|
||||
if (mockedResponse.variableMatcher && variables) {
|
||||
throw new Error("Mocked response should contain either variableMatcher or request.variables");
|
||||
}
|
||||
if (!mockedResponse.variableMatcher) {
|
||||
mockedResponse.variableMatcher = function (vars) {
|
||||
var requestVariables = vars || {};
|
||||
var mockedResponseVariables = variables || {};
|
||||
return equality.equal(requestVariables, mockedResponseVariables);
|
||||
};
|
||||
}
|
||||
};
|
||||
return MockLink;
|
||||
}(core.ApolloLink));
|
||||
function mockSingleLink() {
|
||||
var mockedResponses = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
mockedResponses[_i] = arguments[_i];
|
||||
}
|
||||
var maybeTypename = mockedResponses[mockedResponses.length - 1];
|
||||
var mocks = mockedResponses.slice(0, mockedResponses.length - 1);
|
||||
if (typeof maybeTypename !== "boolean") {
|
||||
mocks = mockedResponses;
|
||||
maybeTypename = true;
|
||||
}
|
||||
return new MockLink(mocks, maybeTypename);
|
||||
}
|
||||
|
||||
var MockSubscriptionLink = (function (_super) {
|
||||
tslib.__extends(MockSubscriptionLink, _super);
|
||||
function MockSubscriptionLink() {
|
||||
var _this = _super.call(this) || this;
|
||||
_this.unsubscribers = [];
|
||||
_this.setups = [];
|
||||
_this.observers = [];
|
||||
return _this;
|
||||
}
|
||||
MockSubscriptionLink.prototype.request = function (operation) {
|
||||
var _this = this;
|
||||
this.operation = operation;
|
||||
return new utilities.Observable(function (observer) {
|
||||
_this.setups.forEach(function (x) { return x(); });
|
||||
_this.observers.push(observer);
|
||||
return function () {
|
||||
_this.unsubscribers.forEach(function (x) { return x(); });
|
||||
};
|
||||
});
|
||||
};
|
||||
MockSubscriptionLink.prototype.simulateResult = function (result, complete) {
|
||||
var _this = this;
|
||||
if (complete === void 0) { complete = false; }
|
||||
setTimeout(function () {
|
||||
var observers = _this.observers;
|
||||
if (!observers.length)
|
||||
throw new Error("subscription torn down");
|
||||
observers.forEach(function (observer) {
|
||||
if (result.result && observer.next)
|
||||
observer.next(result.result);
|
||||
if (result.error && observer.error)
|
||||
observer.error(result.error);
|
||||
if (complete && observer.complete)
|
||||
observer.complete();
|
||||
});
|
||||
}, result.delay || 0);
|
||||
};
|
||||
MockSubscriptionLink.prototype.simulateComplete = function () {
|
||||
var observers = this.observers;
|
||||
if (!observers.length)
|
||||
throw new Error("subscription torn down");
|
||||
observers.forEach(function (observer) {
|
||||
if (observer.complete)
|
||||
observer.complete();
|
||||
});
|
||||
};
|
||||
MockSubscriptionLink.prototype.onSetup = function (listener) {
|
||||
this.setups = this.setups.concat([listener]);
|
||||
};
|
||||
MockSubscriptionLink.prototype.onUnsubscribe = function (listener) {
|
||||
this.unsubscribers = this.unsubscribers.concat([listener]);
|
||||
};
|
||||
return MockSubscriptionLink;
|
||||
}(core.ApolloLink));
|
||||
function mockObservableLink() {
|
||||
return new MockSubscriptionLink();
|
||||
}
|
||||
|
||||
function createMockClient(data, query, variables) {
|
||||
if (variables === void 0) { variables = {}; }
|
||||
return new core$1.ApolloClient({
|
||||
link: mockSingleLink({
|
||||
request: { query: query, variables: variables },
|
||||
result: { data: data },
|
||||
}).setOnError(function (error) {
|
||||
throw error;
|
||||
}),
|
||||
cache: new cache.InMemoryCache({ addTypename: false }),
|
||||
});
|
||||
}
|
||||
|
||||
function subscribeAndCount(reject, observable, cb) {
|
||||
var queue = Promise.resolve();
|
||||
var handleCount = 0;
|
||||
var subscription = utilities.asyncMap(observable, function (result) {
|
||||
return (queue = queue
|
||||
.then(function () {
|
||||
return cb(++handleCount, result);
|
||||
})
|
||||
.catch(error));
|
||||
}).subscribe({ error: error });
|
||||
function error(e) {
|
||||
subscription.unsubscribe();
|
||||
reject(e);
|
||||
}
|
||||
return subscription;
|
||||
}
|
||||
|
||||
function wrap(key) {
|
||||
return function (message, callback, timeout) {
|
||||
return (key ? it[key] : it)(message, function () {
|
||||
var _this = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
return callback.call(_this, resolve, reject);
|
||||
});
|
||||
}, timeout);
|
||||
};
|
||||
}
|
||||
var wrappedIt = wrap();
|
||||
var itAsync = Object.assign(function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
return wrappedIt.apply(this, args);
|
||||
}, {
|
||||
only: wrap("only"),
|
||||
skip: wrap("skip"),
|
||||
todo: wrap("todo"),
|
||||
});
|
||||
|
||||
function wait(ms) {
|
||||
return tslib.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib.__generator(this, function (_a) {
|
||||
return [2 , new Promise(function (resolve) { return setTimeout(resolve, ms); })];
|
||||
});
|
||||
});
|
||||
}
|
||||
function tick() {
|
||||
return tslib.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib.__generator(this, function (_a) {
|
||||
return [2 , wait(0)];
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function wrapTestFunction(fn, consoleMethodName) {
|
||||
return function () {
|
||||
var _this = this;
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
var spy = jest.spyOn(console, consoleMethodName);
|
||||
spy.mockImplementation(function () { });
|
||||
return new Promise(function (resolve) {
|
||||
resolve(fn === null || fn === void 0 ? void 0 : fn.apply(_this, args));
|
||||
}).finally(function () {
|
||||
expect(spy).toMatchSnapshot();
|
||||
spy.mockReset();
|
||||
});
|
||||
};
|
||||
}
|
||||
function withErrorSpy(it) {
|
||||
var args = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
args[_i - 1] = arguments[_i];
|
||||
}
|
||||
args[1] = wrapTestFunction(args[1], "error");
|
||||
return it.apply(void 0, args);
|
||||
}
|
||||
function withWarningSpy(it) {
|
||||
var args = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
args[_i - 1] = arguments[_i];
|
||||
}
|
||||
args[1] = wrapTestFunction(args[1], "warn");
|
||||
return it.apply(void 0, args);
|
||||
}
|
||||
function withLogSpy(it) {
|
||||
var args = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
args[_i - 1] = arguments[_i];
|
||||
}
|
||||
args[1] = wrapTestFunction(args[1], "log");
|
||||
return it.apply(void 0, args);
|
||||
}
|
||||
|
||||
exports.MockLink = MockLink;
|
||||
exports.MockSubscriptionLink = MockSubscriptionLink;
|
||||
exports.createMockClient = createMockClient;
|
||||
exports.itAsync = itAsync;
|
||||
exports.mockObservableLink = mockObservableLink;
|
||||
exports.mockSingleLink = mockSingleLink;
|
||||
exports.subscribeAndCount = subscribeAndCount;
|
||||
exports.tick = tick;
|
||||
exports.wait = wait;
|
||||
exports.withErrorSpy = withErrorSpy;
|
||||
exports.withLogSpy = withLogSpy;
|
||||
exports.withWarningSpy = withWarningSpy;
|
||||
//# sourceMappingURL=core.cjs.map
|
||||
9
graphql-subscription/node_modules/@apollo/client/testing/core/index.d.ts
generated
vendored
Normal file
9
graphql-subscription/node_modules/@apollo/client/testing/core/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export type { MockedResponse, MockLinkOptions, ResultFunction, } from "./mocking/mockLink.js";
|
||||
export { MockLink, mockSingleLink } from "./mocking/mockLink.js";
|
||||
export { MockSubscriptionLink, mockObservableLink, } from "./mocking/mockSubscriptionLink.js";
|
||||
export { createMockClient } from "./mocking/mockClient.js";
|
||||
export { default as subscribeAndCount } from "./subscribeAndCount.js";
|
||||
export { itAsync } from "./itAsync.js";
|
||||
export { wait, tick } from "./wait.js";
|
||||
export * from "./withConsoleSpy.js";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
8
graphql-subscription/node_modules/@apollo/client/testing/core/index.js
generated
vendored
Normal file
8
graphql-subscription/node_modules/@apollo/client/testing/core/index.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export { MockLink, mockSingleLink } from "./mocking/mockLink.js";
|
||||
export { MockSubscriptionLink, mockObservableLink, } from "./mocking/mockSubscriptionLink.js";
|
||||
export { createMockClient } from "./mocking/mockClient.js";
|
||||
export { default as subscribeAndCount } from "./subscribeAndCount.js";
|
||||
export { itAsync } from "./itAsync.js";
|
||||
export { wait, tick } from "./wait.js";
|
||||
export * from "./withConsoleSpy.js";
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/core/index.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/core/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testing/core/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EACL,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACvC,cAAc,qBAAqB,CAAC","sourcesContent":["export type {\n MockedResponse,\n MockLinkOptions,\n ResultFunction,\n} from \"./mocking/mockLink.js\";\nexport { MockLink, mockSingleLink } from \"./mocking/mockLink.js\";\nexport {\n MockSubscriptionLink,\n mockObservableLink,\n} from \"./mocking/mockSubscriptionLink.js\";\nexport { createMockClient } from \"./mocking/mockClient.js\";\nexport { default as subscribeAndCount } from \"./subscribeAndCount.js\";\nexport { itAsync } from \"./itAsync.js\";\nexport { wait, tick } from \"./wait.js\";\nexport * from \"./withConsoleSpy.js\";\n"]}
|
||||
6
graphql-subscription/node_modules/@apollo/client/testing/core/itAsync.d.ts
generated
vendored
Normal file
6
graphql-subscription/node_modules/@apollo/client/testing/core/itAsync.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export declare const itAsync: ((this: unknown, message: string, callback: (resolve: (result?: any) => void, reject: (reason?: any) => void) => any, timeout?: number | undefined) => void) & {
|
||||
only: (message: string, callback: (resolve: (result?: any) => void, reject: (reason?: any) => void) => any, timeout?: number) => void;
|
||||
skip: (message: string, callback: (resolve: (result?: any) => void, reject: (reason?: any) => void) => any, timeout?: number) => void;
|
||||
todo: (message: string, callback: (resolve: (result?: any) => void, reject: (reason?: any) => void) => any, timeout?: number) => void;
|
||||
};
|
||||
//# sourceMappingURL=itAsync.d.ts.map
|
||||
23
graphql-subscription/node_modules/@apollo/client/testing/core/itAsync.js
generated
vendored
Normal file
23
graphql-subscription/node_modules/@apollo/client/testing/core/itAsync.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
function wrap(key) {
|
||||
return function (message, callback, timeout) {
|
||||
return (key ? it[key] : it)(message, function () {
|
||||
var _this = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
return callback.call(_this, resolve, reject);
|
||||
});
|
||||
}, timeout);
|
||||
};
|
||||
}
|
||||
var wrappedIt = wrap();
|
||||
export var itAsync = Object.assign(function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
return wrappedIt.apply(this, args);
|
||||
}, {
|
||||
only: wrap("only"),
|
||||
skip: wrap("skip"),
|
||||
todo: wrap("todo"),
|
||||
});
|
||||
//# sourceMappingURL=itAsync.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/core/itAsync.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/core/itAsync.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"itAsync.js","sourceRoot":"","sources":["../../../src/testing/core/itAsync.ts"],"names":[],"mappings":"AAAA,SAAS,IAAI,CAAC,GAA8B;IAC1C,OAAO,UACL,OAAe,EACf,QAGQ,EACR,OAAgB;QAEhB,OAAA,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAClB,OAAO,EACP;YAAA,iBAIC;YAHC,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;gBACjC,OAAA,QAAQ,CAAC,IAAI,CAAC,KAAI,EAAE,OAAO,EAAE,MAAM,CAAC;YAApC,CAAoC,CACrC,CAAC;QACJ,CAAC,EACD,OAAO,CACR;IARD,CAQC,CAAC;AACN,CAAC;AAED,IAAM,SAAS,GAAG,IAAI,EAAE,CAAC;AAEzB,MAAM,CAAC,IAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAClC;IAAyB,cAAqC;SAArC,UAAqC,EAArC,qBAAqC,EAArC,IAAqC;QAArC,yBAAqC;;IAC5D,OAAO,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACrC,CAAC,EACD;IACE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;IAClB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;IAClB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;CACnB,CACF,CAAC","sourcesContent":["function wrap(key?: \"only\" | \"skip\" | \"todo\") {\n return (\n message: string,\n callback: (\n resolve: (result?: any) => void,\n reject: (reason?: any) => void\n ) => any,\n timeout?: number\n ) =>\n (key ? it[key] : it)(\n message,\n function (this: unknown) {\n return new Promise((resolve, reject) =>\n callback.call(this, resolve, reject)\n );\n },\n timeout\n );\n}\n\nconst wrappedIt = wrap();\n\nexport const itAsync = Object.assign(\n function (this: unknown, ...args: Parameters<typeof wrappedIt>) {\n return wrappedIt.apply(this, args);\n },\n {\n only: wrap(\"only\"),\n skip: wrap(\"skip\"),\n todo: wrap(\"todo\"),\n }\n);\n"]}
|
||||
5
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockClient.d.ts
generated
vendored
Normal file
5
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockClient.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import type { DocumentNode } from "graphql";
|
||||
import { ApolloClient } from "../../../core/index.js";
|
||||
import type { NormalizedCacheObject } from "../../../cache/index.js";
|
||||
export declare function createMockClient<TData>(data: TData, query: DocumentNode, variables?: {}): ApolloClient<NormalizedCacheObject>;
|
||||
//# sourceMappingURL=mockClient.d.ts.map
|
||||
16
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockClient.js
generated
vendored
Normal file
16
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockClient.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { ApolloClient } from "../../../core/index.js";
|
||||
import { InMemoryCache } from "../../../cache/index.js";
|
||||
import { mockSingleLink } from "./mockLink.js";
|
||||
export function createMockClient(data, query, variables) {
|
||||
if (variables === void 0) { variables = {}; }
|
||||
return new ApolloClient({
|
||||
link: mockSingleLink({
|
||||
request: { query: query, variables: variables },
|
||||
result: { data: data },
|
||||
}).setOnError(function (error) {
|
||||
throw error;
|
||||
}),
|
||||
cache: new InMemoryCache({ addTypename: false }),
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=mockClient.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockClient.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockClient.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"mockClient.js","sourceRoot":"","sources":["../../../../src/testing/core/mocking/mockClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,UAAU,gBAAgB,CAC9B,IAAW,EACX,KAAmB,EACnB,SAAc;IAAd,0BAAA,EAAA,cAAc;IAEd,OAAO,IAAI,YAAY,CAAC;QACtB,IAAI,EAAE,cAAc,CAAC;YACnB,OAAO,EAAE,EAAE,KAAK,OAAA,EAAE,SAAS,WAAA,EAAE;YAC7B,MAAM,EAAE,EAAE,IAAI,MAAA,EAAE;SACjB,CAAC,CAAC,UAAU,CAAC,UAAC,KAAK;YAClB,MAAM,KAAK,CAAC;QACd,CAAC,CAAC;QACF,KAAK,EAAE,IAAI,aAAa,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;KACjD,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { DocumentNode } from \"graphql\";\n\nimport { ApolloClient } from \"../../../core/index.js\";\nimport type { NormalizedCacheObject } from \"../../../cache/index.js\";\nimport { InMemoryCache } from \"../../../cache/index.js\";\nimport { mockSingleLink } from \"./mockLink.js\";\n\nexport function createMockClient<TData>(\n data: TData,\n query: DocumentNode,\n variables = {}\n): ApolloClient<NormalizedCacheObject> {\n return new ApolloClient({\n link: mockSingleLink({\n request: { query, variables },\n result: { data },\n }).setOnError((error) => {\n throw error;\n }),\n cache: new InMemoryCache({ addTypename: false }),\n });\n}\n"]}
|
||||
24
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockFetch.d.ts
generated
vendored
Normal file
24
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockFetch.d.ts
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import "whatwg-fetch";
|
||||
export interface MockedIResponse {
|
||||
ok: boolean;
|
||||
status: number;
|
||||
statusText?: string;
|
||||
json(): Promise<Object>;
|
||||
}
|
||||
export interface MockedFetchResponse {
|
||||
url: string;
|
||||
opts: RequestInit;
|
||||
result: MockedIResponse;
|
||||
delay?: number;
|
||||
}
|
||||
export declare function createMockedIResponse(result: Object, options?: any): MockedIResponse;
|
||||
export declare class MockFetch {
|
||||
private mockedResponsesByKey;
|
||||
constructor(...mockedResponses: MockedFetchResponse[]);
|
||||
addMockedResponse(mockedResponse: MockedFetchResponse): void;
|
||||
fetch(url: string, opts: RequestInit): Promise<unknown>;
|
||||
fetchParamsToKey(url: string, opts: RequestInit): string;
|
||||
getFetch(): (url: string, opts: RequestInit) => Promise<unknown>;
|
||||
}
|
||||
export declare function createMockFetch(...mockedResponses: MockedFetchResponse[]): (url: string, opts: RequestInit) => Promise<unknown>;
|
||||
//# sourceMappingURL=mockFetch.d.ts.map
|
||||
87
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockFetch.js
generated
vendored
Normal file
87
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockFetch.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
import { __spreadArray } from "tslib";
|
||||
import "whatwg-fetch";
|
||||
export function createMockedIResponse(result, options) {
|
||||
var status = (options && options.status) || 200;
|
||||
var statusText = (options && options.statusText) || undefined;
|
||||
return {
|
||||
ok: status === 200,
|
||||
status: status,
|
||||
statusText: statusText,
|
||||
json: function () {
|
||||
return Promise.resolve(result);
|
||||
},
|
||||
};
|
||||
}
|
||||
var MockFetch = /** @class */ (function () {
|
||||
function MockFetch() {
|
||||
var mockedResponses = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
mockedResponses[_i] = arguments[_i];
|
||||
}
|
||||
var _this = this;
|
||||
this.mockedResponsesByKey = {};
|
||||
mockedResponses.forEach(function (mockedResponse) {
|
||||
_this.addMockedResponse(mockedResponse);
|
||||
});
|
||||
}
|
||||
MockFetch.prototype.addMockedResponse = function (mockedResponse) {
|
||||
var key = this.fetchParamsToKey(mockedResponse.url, mockedResponse.opts);
|
||||
var mockedResponses = this.mockedResponsesByKey[key];
|
||||
if (!mockedResponses) {
|
||||
mockedResponses = [];
|
||||
this.mockedResponsesByKey[key] = mockedResponses;
|
||||
}
|
||||
mockedResponses.push(mockedResponse);
|
||||
};
|
||||
MockFetch.prototype.fetch = function (url, opts) {
|
||||
var key = this.fetchParamsToKey(url, opts);
|
||||
var responses = this.mockedResponsesByKey[key];
|
||||
if (!responses || responses.length === 0) {
|
||||
throw new Error("No more mocked fetch responses for the params ".concat(url, " and ").concat(opts));
|
||||
}
|
||||
var _a = responses.shift(), result = _a.result, delay = _a.delay;
|
||||
if (!result) {
|
||||
throw new Error("Mocked fetch response should contain a result.");
|
||||
}
|
||||
return new Promise(function (resolve) {
|
||||
setTimeout(function () {
|
||||
resolve(result);
|
||||
}, delay ? delay : 0);
|
||||
});
|
||||
};
|
||||
MockFetch.prototype.fetchParamsToKey = function (url, opts) {
|
||||
return JSON.stringify({
|
||||
url: url,
|
||||
opts: sortByKey(opts),
|
||||
});
|
||||
};
|
||||
// Returns a "fetch" function equivalent that mocks the given responses.
|
||||
// The function by returned by this should be tacked onto the global scope
|
||||
// in order to test functions that use "fetch".
|
||||
MockFetch.prototype.getFetch = function () {
|
||||
return this.fetch.bind(this);
|
||||
};
|
||||
return MockFetch;
|
||||
}());
|
||||
export { MockFetch };
|
||||
function sortByKey(obj) {
|
||||
return Object.keys(obj)
|
||||
.sort()
|
||||
.reduce(function (ret, key) {
|
||||
var _a;
|
||||
return Object.assign((_a = {},
|
||||
_a[key] = (Object.prototype.toString.call(obj[key]).slice(8, -1) ===
|
||||
"Object") ?
|
||||
sortByKey(obj[key])
|
||||
: obj[key],
|
||||
_a), ret);
|
||||
}, {});
|
||||
}
|
||||
export function createMockFetch() {
|
||||
var mockedResponses = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
mockedResponses[_i] = arguments[_i];
|
||||
}
|
||||
return new (MockFetch.bind.apply(MockFetch, __spreadArray([void 0], mockedResponses, false)))().getFetch();
|
||||
}
|
||||
//# sourceMappingURL=mockFetch.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockFetch.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockFetch.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
33
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockLink.d.ts
generated
vendored
Normal file
33
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockLink.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import type { Operation, GraphQLRequest, FetchResult } from "../../../link/core/index.js";
|
||||
import { ApolloLink } from "../../../link/core/index.js";
|
||||
import { Observable } from "../../../utilities/index.js";
|
||||
export type ResultFunction<T, V = Record<string, any>> = (variables: V) => T;
|
||||
export type VariableMatcher<V = Record<string, any>> = (variables: V) => boolean;
|
||||
export interface MockedResponse<TData = Record<string, any>, TVariables = Record<string, any>> {
|
||||
request: GraphQLRequest<TVariables>;
|
||||
maxUsageCount?: number;
|
||||
result?: FetchResult<TData> | ResultFunction<FetchResult<TData>, TVariables>;
|
||||
error?: Error;
|
||||
delay?: number;
|
||||
variableMatcher?: VariableMatcher<TVariables>;
|
||||
newData?: ResultFunction<FetchResult<TData>, TVariables>;
|
||||
}
|
||||
export interface MockLinkOptions {
|
||||
showWarnings?: boolean;
|
||||
}
|
||||
export declare class MockLink extends ApolloLink {
|
||||
operation: Operation;
|
||||
addTypename: Boolean;
|
||||
showWarnings: boolean;
|
||||
private mockedResponsesByKey;
|
||||
constructor(mockedResponses: ReadonlyArray<MockedResponse<any, any>>, addTypename?: Boolean, options?: MockLinkOptions);
|
||||
addMockedResponse(mockedResponse: MockedResponse): void;
|
||||
request(operation: Operation): Observable<FetchResult> | null;
|
||||
private normalizeMockedResponse;
|
||||
private normalizeVariableMatching;
|
||||
}
|
||||
export interface MockApolloLink extends ApolloLink {
|
||||
operation?: Operation;
|
||||
}
|
||||
export declare function mockSingleLink(...mockedResponses: Array<any>): MockApolloLink;
|
||||
//# sourceMappingURL=mockLink.d.ts.map
|
||||
180
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockLink.js
generated
vendored
Normal file
180
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockLink.js
generated
vendored
Normal file
@@ -0,0 +1,180 @@
|
||||
import { __extends } from "tslib";
|
||||
import { invariant } from "../../../utilities/globals/index.js";
|
||||
import { equal } from "@wry/equality";
|
||||
import { ApolloLink } from "../../../link/core/index.js";
|
||||
import { Observable, addTypenameToDocument, removeClientSetsFromDocument, removeConnectionDirectiveFromDocument, cloneDeep, stringifyForDisplay, print, } from "../../../utilities/index.js";
|
||||
function requestToKey(request, addTypename) {
|
||||
var queryString = request.query &&
|
||||
print(addTypename ? addTypenameToDocument(request.query) : request.query);
|
||||
var requestKey = { query: queryString };
|
||||
return JSON.stringify(requestKey);
|
||||
}
|
||||
var MockLink = /** @class */ (function (_super) {
|
||||
__extends(MockLink, _super);
|
||||
function MockLink(mockedResponses, addTypename, options) {
|
||||
if (addTypename === void 0) { addTypename = true; }
|
||||
if (options === void 0) { options = Object.create(null); }
|
||||
var _a;
|
||||
var _this = _super.call(this) || this;
|
||||
_this.addTypename = true;
|
||||
_this.showWarnings = true;
|
||||
_this.mockedResponsesByKey = {};
|
||||
_this.addTypename = addTypename;
|
||||
_this.showWarnings = (_a = options.showWarnings) !== null && _a !== void 0 ? _a : true;
|
||||
if (mockedResponses) {
|
||||
mockedResponses.forEach(function (mockedResponse) {
|
||||
_this.addMockedResponse(mockedResponse);
|
||||
});
|
||||
}
|
||||
return _this;
|
||||
}
|
||||
MockLink.prototype.addMockedResponse = function (mockedResponse) {
|
||||
var normalizedMockedResponse = this.normalizeMockedResponse(mockedResponse);
|
||||
var key = requestToKey(normalizedMockedResponse.request, this.addTypename);
|
||||
var mockedResponses = this.mockedResponsesByKey[key];
|
||||
if (!mockedResponses) {
|
||||
mockedResponses = [];
|
||||
this.mockedResponsesByKey[key] = mockedResponses;
|
||||
}
|
||||
mockedResponses.push(normalizedMockedResponse);
|
||||
};
|
||||
MockLink.prototype.request = function (operation) {
|
||||
var _this = this;
|
||||
var _a;
|
||||
this.operation = operation;
|
||||
var key = requestToKey(operation, this.addTypename);
|
||||
var unmatchedVars = [];
|
||||
var requestVariables = operation.variables || {};
|
||||
var mockedResponses = this.mockedResponsesByKey[key];
|
||||
var responseIndex = mockedResponses ?
|
||||
mockedResponses.findIndex(function (res, index) {
|
||||
var mockedResponseVars = res.request.variables || {};
|
||||
if (equal(requestVariables, mockedResponseVars)) {
|
||||
return true;
|
||||
}
|
||||
if (res.variableMatcher && res.variableMatcher(operation.variables)) {
|
||||
return true;
|
||||
}
|
||||
unmatchedVars.push(mockedResponseVars);
|
||||
return false;
|
||||
})
|
||||
: -1;
|
||||
var response = responseIndex >= 0 ? mockedResponses[responseIndex] : void 0;
|
||||
// There have been platform- and engine-dependent differences with
|
||||
// setInterval(fn, Infinity), so we pass 0 instead (but detect
|
||||
// Infinity where we call observer.error or observer.next to pend
|
||||
// indefinitely in those cases.)
|
||||
var delay = (response === null || response === void 0 ? void 0 : response.delay) === Infinity ? 0 : (_a = response === null || response === void 0 ? void 0 : response.delay) !== null && _a !== void 0 ? _a : 0;
|
||||
var configError;
|
||||
if (!response) {
|
||||
configError = new Error("No more mocked responses for the query: ".concat(print(operation.query), "\nExpected variables: ").concat(stringifyForDisplay(operation.variables), "\n").concat(unmatchedVars.length > 0 ?
|
||||
"\nFailed to match ".concat(unmatchedVars.length, " mock").concat(unmatchedVars.length === 1 ? "" : "s", " for this query. The mocked response had the following variables:\n").concat(unmatchedVars.map(function (d) { return " ".concat(stringifyForDisplay(d)); }).join("\n"), "\n")
|
||||
: ""));
|
||||
if (this.showWarnings) {
|
||||
console.warn(configError.message +
|
||||
"\nThis typically indicates a configuration error in your mocks " +
|
||||
"setup, usually due to a typo or mismatched variable.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (response.maxUsageCount && response.maxUsageCount > 1) {
|
||||
response.maxUsageCount--;
|
||||
}
|
||||
else {
|
||||
mockedResponses.splice(responseIndex, 1);
|
||||
}
|
||||
var newData = response.newData;
|
||||
if (newData) {
|
||||
response.result = newData(operation.variables);
|
||||
mockedResponses.push(response);
|
||||
}
|
||||
if (!response.result && !response.error && response.delay !== Infinity) {
|
||||
configError = new Error("Mocked response should contain either `result`, `error` or a `delay` of `Infinity`: ".concat(key));
|
||||
}
|
||||
}
|
||||
return new Observable(function (observer) {
|
||||
var timer = setTimeout(function () {
|
||||
if (configError) {
|
||||
try {
|
||||
// The onError function can return false to indicate that
|
||||
// configError need not be passed to observer.error. For
|
||||
// example, the default implementation of onError calls
|
||||
// observer.error(configError) and then returns false to
|
||||
// prevent this extra (harmless) observer.error call.
|
||||
if (_this.onError(configError, observer) !== false) {
|
||||
throw configError;
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
observer.error(error);
|
||||
}
|
||||
}
|
||||
else if (response && response.delay !== Infinity) {
|
||||
if (response.error) {
|
||||
observer.error(response.error);
|
||||
}
|
||||
else {
|
||||
if (response.result) {
|
||||
observer.next(typeof response.result === "function" ?
|
||||
response.result(operation.variables)
|
||||
: response.result);
|
||||
}
|
||||
observer.complete();
|
||||
}
|
||||
}
|
||||
}, delay);
|
||||
return function () {
|
||||
clearTimeout(timer);
|
||||
};
|
||||
});
|
||||
};
|
||||
MockLink.prototype.normalizeMockedResponse = function (mockedResponse) {
|
||||
var _a;
|
||||
var newMockedResponse = cloneDeep(mockedResponse);
|
||||
var queryWithoutConnection = removeConnectionDirectiveFromDocument(newMockedResponse.request.query);
|
||||
invariant(queryWithoutConnection, 64);
|
||||
newMockedResponse.request.query = queryWithoutConnection;
|
||||
var query = removeClientSetsFromDocument(newMockedResponse.request.query);
|
||||
if (query) {
|
||||
newMockedResponse.request.query = query;
|
||||
}
|
||||
mockedResponse.maxUsageCount = (_a = mockedResponse.maxUsageCount) !== null && _a !== void 0 ? _a : 1;
|
||||
invariant(mockedResponse.maxUsageCount > 0, 65, mockedResponse.maxUsageCount);
|
||||
this.normalizeVariableMatching(newMockedResponse);
|
||||
return newMockedResponse;
|
||||
};
|
||||
MockLink.prototype.normalizeVariableMatching = function (mockedResponse) {
|
||||
var variables = mockedResponse.request.variables;
|
||||
if (mockedResponse.variableMatcher && variables) {
|
||||
throw new Error("Mocked response should contain either variableMatcher or request.variables");
|
||||
}
|
||||
if (!mockedResponse.variableMatcher) {
|
||||
mockedResponse.variableMatcher = function (vars) {
|
||||
var requestVariables = vars || {};
|
||||
var mockedResponseVariables = variables || {};
|
||||
return equal(requestVariables, mockedResponseVariables);
|
||||
};
|
||||
}
|
||||
};
|
||||
return MockLink;
|
||||
}(ApolloLink));
|
||||
export { MockLink };
|
||||
// Pass in multiple mocked responses, so that you can test flows that end up
|
||||
// making multiple queries to the server.
|
||||
// NOTE: The last arg can optionally be an `addTypename` arg.
|
||||
export function mockSingleLink() {
|
||||
var mockedResponses = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
mockedResponses[_i] = arguments[_i];
|
||||
}
|
||||
// To pull off the potential typename. If this isn't a boolean, we'll just
|
||||
// set it true later.
|
||||
var maybeTypename = mockedResponses[mockedResponses.length - 1];
|
||||
var mocks = mockedResponses.slice(0, mockedResponses.length - 1);
|
||||
if (typeof maybeTypename !== "boolean") {
|
||||
mocks = mockedResponses;
|
||||
maybeTypename = true;
|
||||
}
|
||||
return new MockLink(mocks, maybeTypename);
|
||||
}
|
||||
//# sourceMappingURL=mockLink.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockLink.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockLink.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
5
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockQueryManager.d.ts
generated
vendored
Normal file
5
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockQueryManager.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { QueryManager } from "../../../core/QueryManager.js";
|
||||
import type { MockedResponse } from "./mockLink.js";
|
||||
declare const _default: (...mockedResponses: MockedResponse[]) => QueryManager<import("../../../cache/index.js").NormalizedCacheObject>;
|
||||
export default _default;
|
||||
//# sourceMappingURL=mockQueryManager.d.ts.map
|
||||
16
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockQueryManager.js
generated
vendored
Normal file
16
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockQueryManager.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { QueryManager } from "../../../core/QueryManager.js";
|
||||
import { mockSingleLink } from "./mockLink.js";
|
||||
import { InMemoryCache } from "../../../cache/index.js";
|
||||
// Helper method for the tests that construct a query manager out of a
|
||||
// a list of mocked responses for a mocked network interface.
|
||||
export default (function() {
|
||||
var mockedResponses = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
mockedResponses[_i] = arguments[_i];
|
||||
}
|
||||
return new QueryManager({
|
||||
link: mockSingleLink.apply(void 0, mockedResponses),
|
||||
cache: new InMemoryCache({ addTypename: false }),
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=mockQueryManager.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockQueryManager.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockQueryManager.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"mockQueryManager.js","sourceRoot":"","sources":["../../../../src/testing/core/mocking/mockQueryManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,sEAAsE;AACtE,6DAA6D;AAC7D,gBAAe;IAAC,yBAAoC;SAApC,UAAoC,EAApC,qBAAoC,EAApC,IAAoC;QAApC,oCAAoC;;IAClD,OAAO,IAAI,YAAY,CAAC;QACtB,IAAI,EAAE,cAAc,eAAI,eAAe,CAAC;QACxC,KAAK,EAAE,IAAI,aAAa,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;KACjD,CAAC,CAAC;AACL,CAAC,EAAC","sourcesContent":["import { QueryManager } from \"../../../core/QueryManager.js\";\nimport type { MockedResponse } from \"./mockLink.js\";\nimport { mockSingleLink } from \"./mockLink.js\";\nimport { InMemoryCache } from \"../../../cache/index.js\";\n\n// Helper method for the tests that construct a query manager out of a\n// a list of mocked responses for a mocked network interface.\nexport default (...mockedResponses: MockedResponse[]) => {\n return new QueryManager({\n link: mockSingleLink(...mockedResponses),\n cache: new InMemoryCache({ addTypename: false }),\n });\n};\n"]}
|
||||
25
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockSubscriptionLink.d.ts
generated
vendored
Normal file
25
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockSubscriptionLink.d.ts
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
import { Observable } from "../../../utilities/index.js";
|
||||
import type { FetchResult, Operation } from "../../../link/core/index.js";
|
||||
import { ApolloLink } from "../../../link/core/index.js";
|
||||
export interface MockedSubscription {
|
||||
request: Operation;
|
||||
}
|
||||
export interface MockedSubscriptionResult {
|
||||
result?: FetchResult;
|
||||
error?: Error;
|
||||
delay?: number;
|
||||
}
|
||||
export declare class MockSubscriptionLink extends ApolloLink {
|
||||
unsubscribers: any[];
|
||||
setups: any[];
|
||||
operation?: Operation;
|
||||
private observers;
|
||||
constructor();
|
||||
request(operation: Operation): Observable<FetchResult>;
|
||||
simulateResult(result: MockedSubscriptionResult, complete?: boolean): void;
|
||||
simulateComplete(): void;
|
||||
onSetup(listener: any): void;
|
||||
onUnsubscribe(listener: any): void;
|
||||
}
|
||||
export declare function mockObservableLink(): MockSubscriptionLink;
|
||||
//# sourceMappingURL=mockSubscriptionLink.d.ts.map
|
||||
62
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockSubscriptionLink.js
generated
vendored
Normal file
62
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockSubscriptionLink.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
import { __extends } from "tslib";
|
||||
import { Observable } from "../../../utilities/index.js";
|
||||
import { ApolloLink } from "../../../link/core/index.js";
|
||||
var MockSubscriptionLink = /** @class */ (function (_super) {
|
||||
__extends(MockSubscriptionLink, _super);
|
||||
function MockSubscriptionLink() {
|
||||
var _this = _super.call(this) || this;
|
||||
_this.unsubscribers = [];
|
||||
_this.setups = [];
|
||||
_this.observers = [];
|
||||
return _this;
|
||||
}
|
||||
MockSubscriptionLink.prototype.request = function (operation) {
|
||||
var _this = this;
|
||||
this.operation = operation;
|
||||
return new Observable(function (observer) {
|
||||
_this.setups.forEach(function (x) { return x(); });
|
||||
_this.observers.push(observer);
|
||||
return function () {
|
||||
_this.unsubscribers.forEach(function (x) { return x(); });
|
||||
};
|
||||
});
|
||||
};
|
||||
MockSubscriptionLink.prototype.simulateResult = function (result, complete) {
|
||||
var _this = this;
|
||||
if (complete === void 0) { complete = false; }
|
||||
setTimeout(function () {
|
||||
var observers = _this.observers;
|
||||
if (!observers.length)
|
||||
throw new Error("subscription torn down");
|
||||
observers.forEach(function (observer) {
|
||||
if (result.result && observer.next)
|
||||
observer.next(result.result);
|
||||
if (result.error && observer.error)
|
||||
observer.error(result.error);
|
||||
if (complete && observer.complete)
|
||||
observer.complete();
|
||||
});
|
||||
}, result.delay || 0);
|
||||
};
|
||||
MockSubscriptionLink.prototype.simulateComplete = function () {
|
||||
var observers = this.observers;
|
||||
if (!observers.length)
|
||||
throw new Error("subscription torn down");
|
||||
observers.forEach(function (observer) {
|
||||
if (observer.complete)
|
||||
observer.complete();
|
||||
});
|
||||
};
|
||||
MockSubscriptionLink.prototype.onSetup = function (listener) {
|
||||
this.setups = this.setups.concat([listener]);
|
||||
};
|
||||
MockSubscriptionLink.prototype.onUnsubscribe = function (listener) {
|
||||
this.unsubscribers = this.unsubscribers.concat([listener]);
|
||||
};
|
||||
return MockSubscriptionLink;
|
||||
}(ApolloLink));
|
||||
export { MockSubscriptionLink };
|
||||
export function mockObservableLink() {
|
||||
return new MockSubscriptionLink();
|
||||
}
|
||||
//# sourceMappingURL=mockSubscriptionLink.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockSubscriptionLink.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockSubscriptionLink.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"mockSubscriptionLink.js","sourceRoot":"","sources":["../../../../src/testing/core/mocking/mockSubscriptionLink.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAYzD;IAA0C,wCAAU;IAOlD;QACE,YAAA,MAAK,WAAE,SAAC;QAPH,mBAAa,GAAU,EAAE,CAAC;QAC1B,YAAM,GAAU,EAAE,CAAC;QAGlB,eAAS,GAAU,EAAE,CAAC;;IAI9B,CAAC;IAEM,sCAAO,GAAd,UAAe,SAAoB;QAAnC,iBASC;QARC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,OAAO,IAAI,UAAU,CAAc,UAAC,QAAQ;YAC1C,KAAI,CAAC,MAAM,CAAC,OAAO,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,EAAE,EAAH,CAAG,CAAC,CAAC;YAChC,KAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC9B,OAAO;gBACL,KAAI,CAAC,aAAa,CAAC,OAAO,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,EAAE,EAAH,CAAG,CAAC,CAAC;YACzC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,6CAAc,GAArB,UAAsB,MAAgC,EAAE,QAAgB;QAAxE,iBAUC;QAVuD,yBAAA,EAAA,gBAAgB;QACtE,UAAU,CAAC;YACD,IAAA,SAAS,GAAK,KAAI,UAAT,CAAU;YAC3B,IAAI,CAAC,SAAS,CAAC,MAAM;gBAAE,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;YACjE,SAAS,CAAC,OAAO,CAAC,UAAC,QAAQ;gBACzB,IAAI,MAAM,CAAC,MAAM,IAAI,QAAQ,CAAC,IAAI;oBAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gBACjE,IAAI,MAAM,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK;oBAAE,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACjE,IAAI,QAAQ,IAAI,QAAQ,CAAC,QAAQ;oBAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACzD,CAAC,CAAC,CAAC;QACL,CAAC,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC;IACxB,CAAC;IAEM,+CAAgB,GAAvB;QACU,IAAA,SAAS,GAAK,IAAI,UAAT,CAAU;QAC3B,IAAI,CAAC,SAAS,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;QACjE,SAAS,CAAC,OAAO,CAAC,UAAC,QAAQ;YACzB,IAAI,QAAQ,CAAC,QAAQ;gBAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC;QAC7C,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,sCAAO,GAAd,UAAe,QAAa;QAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC/C,CAAC;IAEM,4CAAa,GAApB,UAAqB,QAAa;QAChC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC7D,CAAC;IACH,2BAAC;AAAD,CAAC,AAjDD,CAA0C,UAAU,GAiDnD;;AAED,MAAM,UAAU,kBAAkB;IAChC,OAAO,IAAI,oBAAoB,EAAE,CAAC;AACpC,CAAC","sourcesContent":["import { Observable } from \"../../../utilities/index.js\";\nimport type { FetchResult, Operation } from \"../../../link/core/index.js\";\nimport { ApolloLink } from \"../../../link/core/index.js\";\n\nexport interface MockedSubscription {\n request: Operation;\n}\n\nexport interface MockedSubscriptionResult {\n result?: FetchResult;\n error?: Error;\n delay?: number;\n}\n\nexport class MockSubscriptionLink extends ApolloLink {\n public unsubscribers: any[] = [];\n public setups: any[] = [];\n public operation?: Operation;\n\n private observers: any[] = [];\n\n constructor() {\n super();\n }\n\n public request(operation: Operation) {\n this.operation = operation;\n return new Observable<FetchResult>((observer) => {\n this.setups.forEach((x) => x());\n this.observers.push(observer);\n return () => {\n this.unsubscribers.forEach((x) => x());\n };\n });\n }\n\n public simulateResult(result: MockedSubscriptionResult, complete = false) {\n setTimeout(() => {\n const { observers } = this;\n if (!observers.length) throw new Error(\"subscription torn down\");\n observers.forEach((observer) => {\n if (result.result && observer.next) observer.next(result.result);\n if (result.error && observer.error) observer.error(result.error);\n if (complete && observer.complete) observer.complete();\n });\n }, result.delay || 0);\n }\n\n public simulateComplete() {\n const { observers } = this;\n if (!observers.length) throw new Error(\"subscription torn down\");\n observers.forEach((observer) => {\n if (observer.complete) observer.complete();\n });\n }\n\n public onSetup(listener: any): void {\n this.setups = this.setups.concat([listener]);\n }\n\n public onUnsubscribe(listener: any): void {\n this.unsubscribers = this.unsubscribers.concat([listener]);\n }\n}\n\nexport function mockObservableLink(): MockSubscriptionLink {\n return new MockSubscriptionLink();\n}\n"]}
|
||||
5
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockWatchQuery.d.ts
generated
vendored
Normal file
5
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockWatchQuery.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import type { MockedResponse } from "./mockLink.js";
|
||||
import type { ObservableQuery } from "../../../core/index.js";
|
||||
declare const _default: (...mockedResponses: MockedResponse[]) => ObservableQuery<any>;
|
||||
export default _default;
|
||||
//# sourceMappingURL=mockWatchQuery.d.ts.map
|
||||
15
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockWatchQuery.js
generated
vendored
Normal file
15
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockWatchQuery.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import mockQueryManager from "./mockQueryManager.js";
|
||||
export default (function() {
|
||||
var mockedResponses = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
mockedResponses[_i] = arguments[_i];
|
||||
}
|
||||
var queryManager = mockQueryManager.apply(void 0, mockedResponses);
|
||||
var firstRequest = mockedResponses[0].request;
|
||||
return queryManager.watchQuery({
|
||||
query: firstRequest.query,
|
||||
variables: firstRequest.variables,
|
||||
notifyOnNetworkStatusChange: false, // XXX might not always be the right option. Set for legacy reasons.
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=mockWatchQuery.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockWatchQuery.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockWatchQuery.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"mockWatchQuery.js","sourceRoot":"","sources":["../../../../src/testing/core/mocking/mockWatchQuery.ts"],"names":[],"mappings":"AACA,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AAGrD,gBAAe;IAAC,yBAAoC;SAApC,UAAoC,EAApC,qBAAoC,EAApC,IAAoC;QAApC,oCAAoC;;IAClD,IAAM,YAAY,GAAG,gBAAgB,eAAI,eAAe,CAAC,CAAC;IAC1D,IAAM,YAAY,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAChD,OAAO,YAAY,CAAC,UAAU,CAAC;QAC7B,KAAK,EAAE,YAAY,CAAC,KAAM;QAC1B,SAAS,EAAE,YAAY,CAAC,SAAS;QACjC,2BAA2B,EAAE,KAAK,EAAE,oEAAoE;KACzG,CAAC,CAAC;AACL,CAAC,EAAC","sourcesContent":["import type { MockedResponse } from \"./mockLink.js\";\nimport mockQueryManager from \"./mockQueryManager.js\";\nimport type { ObservableQuery } from \"../../../core/index.js\";\n\nexport default (...mockedResponses: MockedResponse[]): ObservableQuery<any> => {\n const queryManager = mockQueryManager(...mockedResponses);\n const firstRequest = mockedResponses[0].request;\n return queryManager.watchQuery({\n query: firstRequest.query!,\n variables: firstRequest.variables,\n notifyOnNetworkStatusChange: false, // XXX might not always be the right option. Set for legacy reasons.\n });\n};\n"]}
|
||||
29
graphql-subscription/node_modules/@apollo/client/testing/core/observableToPromise.d.ts
generated
vendored
Normal file
29
graphql-subscription/node_modules/@apollo/client/testing/core/observableToPromise.d.ts
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
import type { ObservableQuery, ApolloQueryResult } from "../../core/index.js";
|
||||
import type { ObservableSubscription } from "../../utilities/index.js";
|
||||
export interface Options {
|
||||
/**
|
||||
* The ObservableQuery to subscribe to.
|
||||
*/
|
||||
observable: ObservableQuery<any, any>;
|
||||
/**
|
||||
* Should we resolve after seeing all our callbacks? [default: true]
|
||||
* (use this if you are racing the promise against another)
|
||||
*/
|
||||
shouldResolve?: boolean;
|
||||
/**
|
||||
* How long to wait after seeing desired callbacks before resolving?
|
||||
* [default: -1 => don't wait]
|
||||
*/
|
||||
wait?: number;
|
||||
/**
|
||||
* An expected set of errors.
|
||||
*/
|
||||
errorCallbacks?: ((error: Error) => any)[];
|
||||
}
|
||||
export type ResultCallback = (result: ApolloQueryResult<any>) => any;
|
||||
export declare function observableToPromiseAndSubscription({ observable, shouldResolve, wait, errorCallbacks }: Options, ...cbs: ResultCallback[]): {
|
||||
promise: Promise<any[]>;
|
||||
subscription: ObservableSubscription;
|
||||
};
|
||||
export default function (options: Options, ...cbs: ResultCallback[]): Promise<any[]>;
|
||||
//# sourceMappingURL=observableToPromise.d.ts.map
|
||||
74
graphql-subscription/node_modules/@apollo/client/testing/core/observableToPromise.js
generated
vendored
Normal file
74
graphql-subscription/node_modules/@apollo/client/testing/core/observableToPromise.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
import { __spreadArray } from "tslib";
|
||||
// Take an observable and N callbacks, and observe the observable,
|
||||
// ensuring it is called exactly N times, resolving once it has done so.
|
||||
// Optionally takes a timeout, which it will wait X ms after the Nth callback
|
||||
// to ensure it is not called again.
|
||||
export function observableToPromiseAndSubscription(_a) {
|
||||
var observable = _a.observable, _b = _a.shouldResolve, shouldResolve = _b === void 0 ? true : _b, _c = _a.wait, wait = _c === void 0 ? -1 : _c, _d = _a.errorCallbacks, errorCallbacks = _d === void 0 ? [] : _d;
|
||||
var cbs = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
cbs[_i - 1] = arguments[_i];
|
||||
}
|
||||
var subscription = null;
|
||||
var promise = new Promise(function (resolve, reject) {
|
||||
var errorIndex = 0;
|
||||
var cbIndex = 0;
|
||||
var results = [];
|
||||
var tryToResolve = function () {
|
||||
if (!shouldResolve) {
|
||||
return;
|
||||
}
|
||||
var done = function () {
|
||||
subscription.unsubscribe();
|
||||
// XXX: we could pass a few other things out here?
|
||||
resolve(results);
|
||||
};
|
||||
if (cbIndex === cbs.length && errorIndex === errorCallbacks.length) {
|
||||
if (wait === -1) {
|
||||
done();
|
||||
}
|
||||
else {
|
||||
setTimeout(done, wait);
|
||||
}
|
||||
}
|
||||
};
|
||||
var queue = Promise.resolve();
|
||||
subscription = observable.subscribe({
|
||||
next: function (result) {
|
||||
queue = queue
|
||||
.then(function () {
|
||||
var cb = cbs[cbIndex++];
|
||||
if (cb)
|
||||
return cb(result);
|
||||
reject(new Error("Observable 'next' method called more than ".concat(cbs.length, " times")));
|
||||
})
|
||||
.then(function (res) {
|
||||
results.push(res);
|
||||
tryToResolve();
|
||||
}, reject);
|
||||
},
|
||||
error: function (error) {
|
||||
queue = queue
|
||||
.then(function () {
|
||||
var errorCb = errorCallbacks[errorIndex++];
|
||||
if (errorCb)
|
||||
return errorCb(error);
|
||||
reject(error);
|
||||
})
|
||||
.then(tryToResolve, reject);
|
||||
},
|
||||
});
|
||||
});
|
||||
return {
|
||||
promise: promise,
|
||||
subscription: subscription,
|
||||
};
|
||||
}
|
||||
export default function (options) {
|
||||
var cbs = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
cbs[_i - 1] = arguments[_i];
|
||||
}
|
||||
return observableToPromiseAndSubscription.apply(void 0, __spreadArray([options], cbs, false)).promise;
|
||||
}
|
||||
//# sourceMappingURL=observableToPromise.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/core/observableToPromise.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/core/observableToPromise.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
graphql-subscription/node_modules/@apollo/client/testing/core/package.json
generated
vendored
Normal file
8
graphql-subscription/node_modules/@apollo/client/testing/core/package.json
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "@apollo/client/testing/core",
|
||||
"type": "module",
|
||||
"main": "core.cjs",
|
||||
"module": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"sideEffects": false
|
||||
}
|
||||
3
graphql-subscription/node_modules/@apollo/client/testing/core/subscribeAndCount.d.ts
generated
vendored
Normal file
3
graphql-subscription/node_modules/@apollo/client/testing/core/subscribeAndCount.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { ObservableSubscription, Observable } from "../../utilities/index.js";
|
||||
export default function subscribeAndCount<TResult>(reject: (reason: any) => any, observable: Observable<TResult>, cb: (handleCount: number, result: TResult) => any): ObservableSubscription;
|
||||
//# sourceMappingURL=subscribeAndCount.d.ts.map
|
||||
21
graphql-subscription/node_modules/@apollo/client/testing/core/subscribeAndCount.js
generated
vendored
Normal file
21
graphql-subscription/node_modules/@apollo/client/testing/core/subscribeAndCount.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import { asyncMap } from "../../utilities/index.js";
|
||||
export default function subscribeAndCount(reject, observable, cb) {
|
||||
// Use a Promise queue to prevent callbacks from being run out of order.
|
||||
var queue = Promise.resolve();
|
||||
var handleCount = 0;
|
||||
var subscription = asyncMap(observable, function (result) {
|
||||
// All previous asynchronous callbacks must complete before cb can
|
||||
// be invoked with this result.
|
||||
return (queue = queue
|
||||
.then(function () {
|
||||
return cb(++handleCount, result);
|
||||
})
|
||||
.catch(error));
|
||||
}).subscribe({ error: error });
|
||||
function error(e) {
|
||||
subscription.unsubscribe();
|
||||
reject(e);
|
||||
}
|
||||
return subscription;
|
||||
}
|
||||
//# sourceMappingURL=subscribeAndCount.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/core/subscribeAndCount.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/core/subscribeAndCount.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"subscribeAndCount.js","sourceRoot":"","sources":["../../../src/testing/core/subscribeAndCount.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,MAA4B,EAC5B,UAA+B,EAC/B,EAAiD;IAEjD,wEAAwE;IACxE,IAAI,KAAK,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAC9B,IAAI,WAAW,GAAG,CAAC,CAAC;IAEpB,IAAM,YAAY,GAAG,QAAQ,CAAC,UAAU,EAAE,UAAC,MAAM;QAC/C,kEAAkE;QAClE,+BAA+B;QAC/B,OAAO,CAAC,KAAK,GAAG,KAAK;aAClB,IAAI,CAAC;YACJ,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;QACnC,CAAC,CAAC;aACD,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACnB,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,KAAK,OAAA,EAAE,CAAC,CAAC;IAExB,SAAS,KAAK,CAAC,CAAM;QACnB,YAAY,CAAC,WAAW,EAAE,CAAC;QAC3B,MAAM,CAAC,CAAC,CAAC,CAAC;IACZ,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC","sourcesContent":["import type {\n ObservableSubscription,\n Observable,\n} from \"../../utilities/index.js\";\nimport { asyncMap } from \"../../utilities/index.js\";\n\nexport default function subscribeAndCount<TResult>(\n reject: (reason: any) => any,\n observable: Observable<TResult>,\n cb: (handleCount: number, result: TResult) => any\n): ObservableSubscription {\n // Use a Promise queue to prevent callbacks from being run out of order.\n let queue = Promise.resolve();\n let handleCount = 0;\n\n const subscription = asyncMap(observable, (result) => {\n // All previous asynchronous callbacks must complete before cb can\n // be invoked with this result.\n return (queue = queue\n .then(() => {\n return cb(++handleCount, result);\n })\n .catch(error));\n }).subscribe({ error });\n\n function error(e: any) {\n subscription.unsubscribe();\n reject(e);\n }\n\n return subscription;\n}\n"]}
|
||||
3
graphql-subscription/node_modules/@apollo/client/testing/core/wait.d.ts
generated
vendored
Normal file
3
graphql-subscription/node_modules/@apollo/client/testing/core/wait.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export declare function wait(ms: number): Promise<void>;
|
||||
export declare function tick(): Promise<void>;
|
||||
//# sourceMappingURL=wait.d.ts.map
|
||||
16
graphql-subscription/node_modules/@apollo/client/testing/core/wait.js
generated
vendored
Normal file
16
graphql-subscription/node_modules/@apollo/client/testing/core/wait.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { __awaiter, __generator } from "tslib";
|
||||
export function wait(ms) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
return __generator(this, function (_a) {
|
||||
return [2 /*return*/, new Promise(function (resolve) { return setTimeout(resolve, ms); })];
|
||||
});
|
||||
});
|
||||
}
|
||||
export function tick() {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
return __generator(this, function (_a) {
|
||||
return [2 /*return*/, wait(0)];
|
||||
});
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=wait.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/core/wait.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/core/wait.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"wait.js","sourceRoot":"","sources":["../../../src/testing/core/wait.ts"],"names":[],"mappings":";AAAA,MAAM,UAAgB,IAAI,CAAC,EAAU;;;YACnC,sBAAO,IAAI,OAAO,CAAO,UAAC,OAAO,IAAK,OAAA,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,EAAvB,CAAuB,CAAC,EAAC;;;CAChE;AAED,MAAM,UAAgB,IAAI;;;YACxB,sBAAO,IAAI,CAAC,CAAC,CAAC,EAAC;;;CAChB","sourcesContent":["export async function wait(ms: number) {\n return new Promise<void>((resolve) => setTimeout(resolve, ms));\n}\n\nexport async function tick() {\n return wait(0);\n}\n"]}
|
||||
7
graphql-subscription/node_modules/@apollo/client/testing/core/withConsoleSpy.d.ts
generated
vendored
Normal file
7
graphql-subscription/node_modules/@apollo/client/testing/core/withConsoleSpy.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/** @deprecated This method will be removed in the next major version of Apollo Client */
|
||||
export declare function withErrorSpy<TArgs extends any[], TResult>(it: (...args: TArgs) => TResult, ...args: TArgs): TResult;
|
||||
/** @deprecated This method will be removed in the next major version of Apollo Client */
|
||||
export declare function withWarningSpy<TArgs extends any[], TResult>(it: (...args: TArgs) => TResult, ...args: TArgs): TResult;
|
||||
/** @deprecated This method will be removed in the next major version of Apollo Client */
|
||||
export declare function withLogSpy<TArgs extends any[], TResult>(it: (...args: TArgs) => TResult, ...args: TArgs): TResult;
|
||||
//# sourceMappingURL=withConsoleSpy.d.ts.map
|
||||
45
graphql-subscription/node_modules/@apollo/client/testing/core/withConsoleSpy.js
generated
vendored
Normal file
45
graphql-subscription/node_modules/@apollo/client/testing/core/withConsoleSpy.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
function wrapTestFunction(fn, consoleMethodName) {
|
||||
return function () {
|
||||
var _this = this;
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
var spy = jest.spyOn(console, consoleMethodName);
|
||||
spy.mockImplementation(function () { });
|
||||
return new Promise(function (resolve) {
|
||||
resolve(fn === null || fn === void 0 ? void 0 : fn.apply(_this, args));
|
||||
}).finally(function () {
|
||||
expect(spy).toMatchSnapshot();
|
||||
spy.mockReset();
|
||||
});
|
||||
};
|
||||
}
|
||||
/** @deprecated This method will be removed in the next major version of Apollo Client */
|
||||
export function withErrorSpy(it) {
|
||||
var args = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
args[_i - 1] = arguments[_i];
|
||||
}
|
||||
args[1] = wrapTestFunction(args[1], "error");
|
||||
return it.apply(void 0, args);
|
||||
}
|
||||
/** @deprecated This method will be removed in the next major version of Apollo Client */
|
||||
export function withWarningSpy(it) {
|
||||
var args = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
args[_i - 1] = arguments[_i];
|
||||
}
|
||||
args[1] = wrapTestFunction(args[1], "warn");
|
||||
return it.apply(void 0, args);
|
||||
}
|
||||
/** @deprecated This method will be removed in the next major version of Apollo Client */
|
||||
export function withLogSpy(it) {
|
||||
var args = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
args[_i - 1] = arguments[_i];
|
||||
}
|
||||
args[1] = wrapTestFunction(args[1], "log");
|
||||
return it.apply(void 0, args);
|
||||
}
|
||||
//# sourceMappingURL=withConsoleSpy.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/core/withConsoleSpy.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/core/withConsoleSpy.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"withConsoleSpy.js","sourceRoot":"","sources":["../../../src/testing/core/withConsoleSpy.ts"],"names":[],"mappings":"AAAA,SAAS,gBAAgB,CACvB,EAA2B,EAC3B,iBAA2C;IAE3C,OAAO;QAAA,iBASN;QAT2B,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;QACxC,IAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;QACnD,GAAG,CAAC,kBAAkB,CAAC,cAAO,CAAC,CAAC,CAAC;QACjC,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO;YACzB,OAAO,CAAC,EAAE,aAAF,EAAE,uBAAF,EAAE,CAAE,KAAK,CAAC,KAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC,OAAO,CAAC;YACT,MAAM,CAAC,GAAG,CAAC,CAAC,eAAe,EAAE,CAAC;YAC9B,GAAG,CAAC,SAAS,EAAE,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAED,yFAAyF;AACzF,MAAM,UAAU,YAAY,CAC1B,EAA+B;IAC/B,cAAc;SAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;QAAd,6BAAc;;IAEd,IAAI,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAC7C,OAAO,EAAE,eAAI,IAAI,EAAE;AACrB,CAAC;AAED,yFAAyF;AACzF,MAAM,UAAU,cAAc,CAC5B,EAA+B;IAC/B,cAAc;SAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;QAAd,6BAAc;;IAEd,IAAI,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAC5C,OAAO,EAAE,eAAI,IAAI,EAAE;AACrB,CAAC;AAED,yFAAyF;AACzF,MAAM,UAAU,UAAU,CACxB,EAA+B;IAC/B,cAAc;SAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;QAAd,6BAAc;;IAEd,IAAI,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAC3C,OAAO,EAAE,eAAI,IAAI,EAAE;AACrB,CAAC","sourcesContent":["function wrapTestFunction(\n fn: (...args: any[]) => any,\n consoleMethodName: \"log\" | \"warn\" | \"error\"\n) {\n return function (this: any, ...args: any[]) {\n const spy = jest.spyOn(console, consoleMethodName);\n spy.mockImplementation(() => {});\n return new Promise((resolve) => {\n resolve(fn?.apply(this, args));\n }).finally(() => {\n expect(spy).toMatchSnapshot();\n spy.mockReset();\n });\n };\n}\n\n/** @deprecated This method will be removed in the next major version of Apollo Client */\nexport function withErrorSpy<TArgs extends any[], TResult>(\n it: (...args: TArgs) => TResult,\n ...args: TArgs\n) {\n args[1] = wrapTestFunction(args[1], \"error\");\n return it(...args);\n}\n\n/** @deprecated This method will be removed in the next major version of Apollo Client */\nexport function withWarningSpy<TArgs extends any[], TResult>(\n it: (...args: TArgs) => TResult,\n ...args: TArgs\n) {\n args[1] = wrapTestFunction(args[1], \"warn\");\n return it(...args);\n}\n\n/** @deprecated This method will be removed in the next major version of Apollo Client */\nexport function withLogSpy<TArgs extends any[], TResult>(\n it: (...args: TArgs) => TResult,\n ...args: TArgs\n) {\n args[1] = wrapTestFunction(args[1], \"log\");\n return it(...args);\n}\n"]}
|
||||
4
graphql-subscription/node_modules/@apollo/client/testing/core/wrap.d.ts
generated
vendored
Normal file
4
graphql-subscription/node_modules/@apollo/client/testing/core/wrap.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
declare const _default: <TArgs extends any[], TResult>(reject: (reason: any) => any, cb: (...args: TArgs) => TResult) => (...args: TArgs) => TResult | undefined;
|
||||
export default _default;
|
||||
export declare function withError(func: Function, regex: RegExp): any;
|
||||
//# sourceMappingURL=wrap.d.ts.map
|
||||
30
graphql-subscription/node_modules/@apollo/client/testing/core/wrap.js
generated
vendored
Normal file
30
graphql-subscription/node_modules/@apollo/client/testing/core/wrap.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
// I'm not sure why mocha doesn't provide something like this, you can't
|
||||
// always use promises
|
||||
export default (function(reject, cb) {
|
||||
return function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
try {
|
||||
return cb.apply(void 0, args);
|
||||
}
|
||||
catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
};
|
||||
});
|
||||
export function withError(func, regex) {
|
||||
var message = null;
|
||||
var oldError = console.error;
|
||||
console.error = function (m) { return (message = m); };
|
||||
try {
|
||||
var result = func();
|
||||
expect(message).toMatch(regex);
|
||||
return result;
|
||||
}
|
||||
finally {
|
||||
console.error = oldError;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=wrap.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/core/wrap.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/core/wrap.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"wrap.js","sourceRoot":"","sources":["../../../src/testing/core/wrap.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,sBAAsB;AACtB,gBAAe,UACX,MAA4B,EAC5B,EAA+B;IAEjC,OAAA;QAAC,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;QACb,IAAI,CAAC;YACH,OAAO,EAAE,eAAI,IAAI,EAAE;QACrB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,CAAC,CAAC,CAAC,CAAC;QACZ,CAAC;IACH,CAAC;AAND,CAMC,EAAC;AAEJ,MAAM,UAAU,SAAS,CAAC,IAAc,EAAE,KAAa;IACrD,IAAI,OAAO,GAAW,IAAa,CAAC;IACpC,IAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC;IAE/B,OAAO,CAAC,KAAK,GAAG,UAAC,CAAS,IAAK,OAAA,CAAC,OAAO,GAAG,CAAC,CAAC,EAAb,CAAa,CAAC;IAE7C,IAAI,CAAC;QACH,IAAM,MAAM,GAAG,IAAI,EAAE,CAAC;QACtB,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC/B,OAAO,MAAM,CAAC;IAChB,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC;IAC3B,CAAC;AACH,CAAC","sourcesContent":["// I'm not sure why mocha doesn't provide something like this, you can't\n// always use promises\nexport default <TArgs extends any[], TResult>(\n reject: (reason: any) => any,\n cb: (...args: TArgs) => TResult\n ) =>\n (...args: TArgs) => {\n try {\n return cb(...args);\n } catch (e) {\n reject(e);\n }\n };\n\nexport function withError(func: Function, regex: RegExp) {\n let message: string = null as never;\n const oldError = console.error;\n\n console.error = (m: string) => (message = m);\n\n try {\n const result = func();\n expect(message).toMatch(regex);\n return result;\n } finally {\n console.error = oldError;\n }\n}\n"]}
|
||||
5
graphql-subscription/node_modules/@apollo/client/testing/index.d.ts
generated
vendored
Normal file
5
graphql-subscription/node_modules/@apollo/client/testing/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import "../utilities/globals/index.js";
|
||||
export type { MockedProviderProps } from "./react/MockedProvider.js";
|
||||
export { MockedProvider } from "./react/MockedProvider.js";
|
||||
export * from "./core/index.js";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
4
graphql-subscription/node_modules/@apollo/client/testing/index.js
generated
vendored
Normal file
4
graphql-subscription/node_modules/@apollo/client/testing/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import "../utilities/globals/index.js";
|
||||
export { MockedProvider } from "./react/MockedProvider.js";
|
||||
export * from "./core/index.js";
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/index.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,+BAA+B,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,cAAc,iBAAiB,CAAC","sourcesContent":["import \"../utilities/globals/index.js\";\nexport type { MockedProviderProps } from \"./react/MockedProvider.js\";\nexport { MockedProvider } from \"./react/MockedProvider.js\";\nexport * from \"./core/index.js\";\n"]}
|
||||
26
graphql-subscription/node_modules/@apollo/client/testing/internal/ObservableStream.d.ts
generated
vendored
Normal file
26
graphql-subscription/node_modules/@apollo/client/testing/internal/ObservableStream.d.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import type { Observable } from "../../utilities/index.js";
|
||||
interface TakeOptions {
|
||||
timeout?: number;
|
||||
}
|
||||
type ObservableEvent<T> = {
|
||||
type: "next";
|
||||
value: T;
|
||||
} | {
|
||||
type: "error";
|
||||
error: any;
|
||||
} | {
|
||||
type: "complete";
|
||||
};
|
||||
declare class IteratorStream<T> {
|
||||
private iterator;
|
||||
constructor(iterator: AsyncGenerator<T, void, unknown>);
|
||||
take({ timeout }?: TakeOptions): Promise<T>;
|
||||
}
|
||||
export declare class ObservableStream<T> extends IteratorStream<ObservableEvent<T>> {
|
||||
constructor(observable: Observable<T>);
|
||||
takeNext(options?: TakeOptions): Promise<T>;
|
||||
takeError(options?: TakeOptions): Promise<any>;
|
||||
takeComplete(options?: TakeOptions): Promise<void>;
|
||||
}
|
||||
export {};
|
||||
//# sourceMappingURL=ObservableStream.d.ts.map
|
||||
109
graphql-subscription/node_modules/@apollo/client/testing/internal/ObservableStream.js
generated
vendored
Normal file
109
graphql-subscription/node_modules/@apollo/client/testing/internal/ObservableStream.js
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
import { __asyncGenerator, __await, __awaiter, __extends, __generator } from "tslib";
|
||||
function observableToAsyncEventIterator(observable) {
|
||||
return __asyncGenerator(this, arguments, function observableToAsyncEventIterator_1() {
|
||||
function queuePromise() {
|
||||
promises.push(new Promise(function (resolve) {
|
||||
resolveNext = function (event) {
|
||||
resolve(event);
|
||||
queuePromise();
|
||||
};
|
||||
}));
|
||||
}
|
||||
var resolveNext, promises;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
promises = [];
|
||||
queuePromise();
|
||||
observable.subscribe(function (value) { return resolveNext({ type: "next", value: value }); }, function (error) { return resolveNext({ type: "error", error: error }); }, function () { return resolveNext({ type: "complete" }); });
|
||||
return [4 /*yield*/, __await("initialization value")];
|
||||
case 1: return [4 /*yield*/, _a.sent()];
|
||||
case 2:
|
||||
_a.sent();
|
||||
_a.label = 3;
|
||||
case 3:
|
||||
if (!true) return [3 /*break*/, 6];
|
||||
return [4 /*yield*/, __await(promises.shift())];
|
||||
case 4: return [4 /*yield*/, _a.sent()];
|
||||
case 5:
|
||||
_a.sent();
|
||||
return [3 /*break*/, 3];
|
||||
case 6: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
var IteratorStream = /** @class */ (function () {
|
||||
function IteratorStream(iterator) {
|
||||
this.iterator = iterator;
|
||||
}
|
||||
IteratorStream.prototype.take = function (_a) {
|
||||
var _b = _a === void 0 ? {} : _a, _c = _b.timeout, timeout = _c === void 0 ? 100 : _c;
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
return __generator(this, function (_d) {
|
||||
return [2 /*return*/, Promise.race([
|
||||
this.iterator.next().then(function (result) { return result.value; }),
|
||||
new Promise(function (_, reject) {
|
||||
setTimeout(reject, timeout, new Error("Timeout waiting for next event"));
|
||||
}),
|
||||
])];
|
||||
});
|
||||
});
|
||||
};
|
||||
return IteratorStream;
|
||||
}());
|
||||
var ObservableStream = /** @class */ (function (_super) {
|
||||
__extends(ObservableStream, _super);
|
||||
function ObservableStream(observable) {
|
||||
var iterator = observableToAsyncEventIterator(observable);
|
||||
// we need to call next() once to start the generator so we immediately subscribe.
|
||||
// the first value is always "initialization value" which we don't care about
|
||||
iterator.next();
|
||||
return _super.call(this, iterator) || this;
|
||||
}
|
||||
ObservableStream.prototype.takeNext = function (options) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var event;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, this.take(options)];
|
||||
case 1:
|
||||
event = _a.sent();
|
||||
expect(event).toEqual({ type: "next", value: expect.anything() });
|
||||
return [2 /*return*/, event.value];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
ObservableStream.prototype.takeError = function (options) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var event;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, this.take(options)];
|
||||
case 1:
|
||||
event = _a.sent();
|
||||
expect(event).toEqual({ type: "error", error: expect.anything() });
|
||||
return [2 /*return*/, event.error];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
ObservableStream.prototype.takeComplete = function (options) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var event;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, this.take(options)];
|
||||
case 1:
|
||||
event = _a.sent();
|
||||
expect(event).toEqual({ type: "complete" });
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
return ObservableStream;
|
||||
}(IteratorStream));
|
||||
export { ObservableStream };
|
||||
//# sourceMappingURL=ObservableStream.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/internal/ObservableStream.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/internal/ObservableStream.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ObservableStream.js","sourceRoot":"","sources":["../../../src/testing/internal/ObservableStream.ts"],"names":[],"mappings":";AAUA,SAAgB,8BAA8B,CAAI,UAAyB;;QAKzE,SAAS,YAAY;YACnB,QAAQ,CAAC,IAAI,CACX,IAAI,OAAO,CAAqB,UAAC,OAAO;gBACtC,WAAW,GAAG,UAAC,KAAyB;oBACtC,OAAO,CAAC,KAAK,CAAC,CAAC;oBACf,YAAY,EAAE,CAAC;gBACjB,CAAC,CAAC;YACJ,CAAC,CAAC,CACH,CAAC;QACJ,CAAC;;;;;oBAZK,QAAQ,GAAkC,EAAE,CAAC;oBACnD,YAAY,EAAE,CAAC;oBAaf,UAAU,CAAC,SAAS,CAClB,UAAC,KAAK,IAAK,OAAA,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,OAAA,EAAE,CAAC,EAApC,CAAoC,EAC/C,UAAC,KAAK,IAAK,OAAA,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,OAAA,EAAE,CAAC,EAArC,CAAqC,EAChD,cAAM,OAAA,WAAW,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAjC,CAAiC,CACxC,CAAC;iDACI,sBAAgE;wBAAtE,gCAAsE;;oBAAtE,SAAsE,CAAC;;;yBAEhE,IAAI;iDACH,QAAQ,CAAC,KAAK,EAAG;wBAAvB,gCAAuB;;oBAAvB,SAAuB,CAAC;;;;;;CAE3B;AAED;IACE,wBAAoB,QAA0C;QAA1C,aAAQ,GAAR,QAAQ,CAAkC;IAAG,CAAC;IAE5D,6BAAI,GAAV,UAAW,EAAmC;YAAnC,qBAAiC,EAAE,KAAA,EAAjC,eAAa,EAAb,OAAO,mBAAG,GAAG,KAAA;;;gBACxB,sBAAO,OAAO,CAAC,IAAI,CAAC;wBAClB,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,UAAC,MAAM,IAAK,OAAA,MAAM,CAAC,KAAM,EAAb,CAAa,CAAC;wBACpD,IAAI,OAAO,CAAI,UAAC,CAAC,EAAE,MAAM;4BACvB,UAAU,CACR,MAAM,EACN,OAAO,EACP,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAC5C,CAAC;wBACJ,CAAC,CAAC;qBACH,CAAC,EAAC;;;KACJ;IACH,qBAAC;AAAD,CAAC,AAfD,IAeC;AAED;IAAyC,oCAAkC;IACzE,0BAAY,UAAyB;QACnC,IAAM,QAAQ,GAAG,8BAA8B,CAAC,UAAU,CAAC,CAAC;QAC5D,kFAAkF;QAClF,6EAA6E;QAC7E,QAAQ,CAAC,IAAI,EAAE,CAAC;QAChB,OAAA,MAAK,YAAC,QAAQ,CAAC,SAAC;IAClB,CAAC;IAEK,mCAAQ,GAAd,UAAe,OAAqB;;;;;4BACpB,qBAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAA;;wBAAhC,KAAK,GAAG,SAAwB;wBACtC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;wBAClE,sBAAQ,KAA+C,CAAC,KAAK,EAAC;;;;KAC/D;IAEK,oCAAS,GAAf,UAAgB,OAAqB;;;;;4BACrB,qBAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAA;;wBAAhC,KAAK,GAAG,SAAwB;wBACtC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;wBACnE,sBAAQ,KAAgD,CAAC,KAAK,EAAC;;;;KAChE;IAEK,uCAAY,GAAlB,UAAmB,OAAqB;;;;;4BACxB,qBAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAA;;wBAAhC,KAAK,GAAG,SAAwB;wBACtC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;;;;;KAC7C;IACH,uBAAC;AAAD,CAAC,AAzBD,CAAyC,cAAc,GAyBtD","sourcesContent":["import type { Observable } from \"../../utilities/index.js\";\n\ninterface TakeOptions {\n timeout?: number;\n}\ntype ObservableEvent<T> =\n | { type: \"next\"; value: T }\n | { type: \"error\"; error: any }\n | { type: \"complete\" };\n\nasync function* observableToAsyncEventIterator<T>(observable: Observable<T>) {\n let resolveNext: (value: ObservableEvent<T>) => void;\n const promises: Promise<ObservableEvent<T>>[] = [];\n queuePromise();\n\n function queuePromise() {\n promises.push(\n new Promise<ObservableEvent<T>>((resolve) => {\n resolveNext = (event: ObservableEvent<T>) => {\n resolve(event);\n queuePromise();\n };\n })\n );\n }\n\n observable.subscribe(\n (value) => resolveNext({ type: \"next\", value }),\n (error) => resolveNext({ type: \"error\", error }),\n () => resolveNext({ type: \"complete\" })\n );\n yield \"initialization value\" as unknown as Promise<ObservableEvent<T>>;\n\n while (true) {\n yield promises.shift()!;\n }\n}\n\nclass IteratorStream<T> {\n constructor(private iterator: AsyncGenerator<T, void, unknown>) {}\n\n async take({ timeout = 100 }: TakeOptions = {}): Promise<T> {\n return Promise.race([\n this.iterator.next().then((result) => result.value!),\n new Promise<T>((_, reject) => {\n setTimeout(\n reject,\n timeout,\n new Error(\"Timeout waiting for next event\")\n );\n }),\n ]);\n }\n}\n\nexport class ObservableStream<T> extends IteratorStream<ObservableEvent<T>> {\n constructor(observable: Observable<T>) {\n const iterator = observableToAsyncEventIterator(observable);\n // we need to call next() once to start the generator so we immediately subscribe.\n // the first value is always \"initialization value\" which we don't care about\n iterator.next();\n super(iterator);\n }\n\n async takeNext(options?: TakeOptions): Promise<T> {\n const event = await this.take(options);\n expect(event).toEqual({ type: \"next\", value: expect.anything() });\n return (event as ObservableEvent<T> & { type: \"next\" }).value;\n }\n\n async takeError(options?: TakeOptions): Promise<any> {\n const event = await this.take(options);\n expect(event).toEqual({ type: \"error\", error: expect.anything() });\n return (event as ObservableEvent<T> & { type: \"error\" }).error;\n }\n\n async takeComplete(options?: TakeOptions): Promise<void> {\n const event = await this.take(options);\n expect(event).toEqual({ type: \"complete\" });\n }\n}\n"]}
|
||||
10
graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/disableActWarnings.d.ts
generated
vendored
Normal file
10
graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/disableActWarnings.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
/// <reference types="node" />
|
||||
/**
|
||||
* Temporarily disable act warnings.
|
||||
*
|
||||
* https://github.com/reactwg/react-18/discussions/102
|
||||
*/
|
||||
export declare function disableActWarnings(): {
|
||||
prevActEnv: any;
|
||||
} & Disposable;
|
||||
//# sourceMappingURL=disableActWarnings.d.ts.map
|
||||
15
graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/disableActWarnings.js
generated
vendored
Normal file
15
graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/disableActWarnings.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import { withCleanup } from "./withCleanup.js";
|
||||
/**
|
||||
* Temporarily disable act warnings.
|
||||
*
|
||||
* https://github.com/reactwg/react-18/discussions/102
|
||||
*/
|
||||
export function disableActWarnings() {
|
||||
var prev = { prevActEnv: globalThis.IS_REACT_ACT_ENVIRONMENT };
|
||||
globalThis.IS_REACT_ACT_ENVIRONMENT = false;
|
||||
return withCleanup(prev, function (_a) {
|
||||
var prevActEnv = _a.prevActEnv;
|
||||
globalThis.IS_REACT_ACT_ENVIRONMENT = prevActEnv;
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=disableActWarnings.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/disableActWarnings.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/disableActWarnings.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"disableActWarnings.js","sourceRoot":"","sources":["../../../../src/testing/internal/disposables/disableActWarnings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,UAAU,kBAAkB;IAChC,IAAM,IAAI,GAAG,EAAE,UAAU,EAAG,UAAkB,CAAC,wBAAwB,EAAE,CAAC;IACzE,UAAkB,CAAC,wBAAwB,GAAG,KAAK,CAAC;IAErD,OAAO,WAAW,CAAC,IAAI,EAAE,UAAC,EAAc;YAAZ,UAAU,gBAAA;QACnC,UAAkB,CAAC,wBAAwB,GAAG,UAAU,CAAC;IAC5D,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { withCleanup } from \"./withCleanup.js\";\n\n/**\n * Temporarily disable act warnings.\n *\n * https://github.com/reactwg/react-18/discussions/102\n */\nexport function disableActWarnings() {\n const prev = { prevActEnv: (globalThis as any).IS_REACT_ACT_ENVIRONMENT };\n (globalThis as any).IS_REACT_ACT_ENVIRONMENT = false;\n\n return withCleanup(prev, ({ prevActEnv }) => {\n (globalThis as any).IS_REACT_ACT_ENVIRONMENT = prevActEnv;\n });\n}\n"]}
|
||||
4
graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/index.d.ts
generated
vendored
Normal file
4
graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export { disableActWarnings } from "./disableActWarnings.js";
|
||||
export { spyOnConsole } from "./spyOnConsole.js";
|
||||
export { withCleanup } from "./withCleanup.js";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
4
graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/index.js
generated
vendored
Normal file
4
graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export { disableActWarnings } from "./disableActWarnings.js";
|
||||
export { spyOnConsole } from "./spyOnConsole.js";
|
||||
export { withCleanup } from "./withCleanup.js";
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/index.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/testing/internal/disposables/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export { disableActWarnings } from \"./disableActWarnings.js\";\nexport { spyOnConsole } from \"./spyOnConsole.js\";\nexport { withCleanup } from \"./withCleanup.js\";\n"]}
|
||||
11
graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/spyOnConsole.d.ts
generated
vendored
Normal file
11
graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/spyOnConsole.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="jest" />
|
||||
type ConsoleMethod = "log" | "info" | "warn" | "error" | "debug";
|
||||
type Spies<Keys extends ConsoleMethod[]> = Record<Keys[number], jest.SpyInstance<void, any[], any>>;
|
||||
/** @internal */
|
||||
export declare function spyOnConsole<Keys extends ConsoleMethod[]>(...spyOn: Keys): Spies<Keys> & Disposable;
|
||||
export declare namespace spyOnConsole {
|
||||
var takeSnapshots: <Keys extends ConsoleMethod[]>(...spyOn: Keys) => Spies<Keys> & Disposable;
|
||||
}
|
||||
export {};
|
||||
//# sourceMappingURL=spyOnConsole.d.ts.map
|
||||
35
graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/spyOnConsole.js
generated
vendored
Normal file
35
graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/spyOnConsole.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
import { withCleanup } from "./withCleanup.js";
|
||||
var noOp = function () { };
|
||||
var restore = function (spy) { return spy.mockRestore(); };
|
||||
/** @internal */
|
||||
export function spyOnConsole() {
|
||||
var spyOn = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
spyOn[_i] = arguments[_i];
|
||||
}
|
||||
var spies = {};
|
||||
for (var _a = 0, spyOn_1 = spyOn; _a < spyOn_1.length; _a++) {
|
||||
var key = spyOn_1[_a];
|
||||
// @ts-ignore
|
||||
spies[key] = jest.spyOn(console, key).mockImplementation(noOp);
|
||||
}
|
||||
return withCleanup(spies, function (spies) {
|
||||
for (var _i = 0, _a = Object.values(spies); _i < _a.length; _i++) {
|
||||
var spy = _a[_i];
|
||||
restore(spy);
|
||||
}
|
||||
});
|
||||
}
|
||||
spyOnConsole.takeSnapshots = function () {
|
||||
var spyOn = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
spyOn[_i] = arguments[_i];
|
||||
}
|
||||
return withCleanup(spyOnConsole.apply(void 0, spyOn), function (spies) {
|
||||
for (var _i = 0, _a = Object.values(spies); _i < _a.length; _i++) {
|
||||
var spy = _a[_i];
|
||||
expect(spy).toMatchSnapshot();
|
||||
}
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=spyOnConsole.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/spyOnConsole.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/spyOnConsole.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"spyOnConsole.js","sourceRoot":"","sources":["../../../../src/testing/internal/disposables/spyOnConsole.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,IAAM,IAAI,GAAG,cAAO,CAAC,CAAC;AACtB,IAAM,OAAO,GAAG,UAAC,GAAqB,IAAK,OAAA,GAAG,CAAC,WAAW,EAAE,EAAjB,CAAiB,CAAC;AAS7D,gBAAgB;AAChB,MAAM,UAAU,YAAY;IAC1B,eAAc;SAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;QAAd,0BAAc;;IAEd,IAAM,KAAK,GAAG,EAAiB,CAAC;IAChC,KAAkB,UAAK,EAAL,eAAK,EAAL,mBAAK,EAAL,IAAK,EAAE,CAAC;QAArB,IAAM,GAAG,cAAA;QACZ,aAAa;QACb,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,WAAW,CAAC,KAAK,EAAE,UAAC,KAAK;QAC9B,KAAkB,UAA0C,EAA1C,KAAA,MAAM,CAAC,MAAM,CAAC,KAAK,CAAuB,EAA1C,cAA0C,EAA1C,IAA0C,EAAE,CAAC;YAA1D,IAAM,GAAG,SAAA;YACZ,OAAO,CAAC,GAAG,CAAC,CAAC;QACf,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,YAAY,CAAC,aAAa,GAAG;IAC3B,eAAc;SAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;QAAd,0BAAc;;IAEd,OAAA,WAAW,CAAC,YAAY,eAAI,KAAK,GAAG,UAAC,KAAK;QACxC,KAAkB,UAA0C,EAA1C,KAAA,MAAM,CAAC,MAAM,CAAC,KAAK,CAAuB,EAA1C,cAA0C,EAA1C,IAA0C,EAAE,CAAC;YAA1D,IAAM,GAAG,SAAA;YACZ,MAAM,CAAC,GAAG,CAAC,CAAC,eAAe,EAAE,CAAC;QAChC,CAAC;IACH,CAAC,CAAC;AAJF,CAIE,CAAC","sourcesContent":["import { withCleanup } from \"./withCleanup.js\";\n\nconst noOp = () => {};\nconst restore = (spy: jest.SpyInstance) => spy.mockRestore();\n\ntype ConsoleMethod = \"log\" | \"info\" | \"warn\" | \"error\" | \"debug\";\n\ntype Spies<Keys extends ConsoleMethod[]> = Record<\n Keys[number],\n jest.SpyInstance<void, any[], any>\n>;\n\n/** @internal */\nexport function spyOnConsole<Keys extends ConsoleMethod[]>(\n ...spyOn: Keys\n): Spies<Keys> & Disposable {\n const spies = {} as Spies<Keys>;\n for (const key of spyOn) {\n // @ts-ignore\n spies[key] = jest.spyOn(console, key).mockImplementation(noOp);\n }\n return withCleanup(spies, (spies) => {\n for (const spy of Object.values(spies) as jest.SpyInstance[]) {\n restore(spy);\n }\n });\n}\n\nspyOnConsole.takeSnapshots = <Keys extends ConsoleMethod[]>(\n ...spyOn: Keys\n): Spies<Keys> & Disposable =>\n withCleanup(spyOnConsole(...spyOn), (spies) => {\n for (const spy of Object.values(spies) as jest.SpyInstance[]) {\n expect(spy).toMatchSnapshot();\n }\n });\n"]}
|
||||
4
graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/withCleanup.d.ts
generated
vendored
Normal file
4
graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/withCleanup.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/// <reference types="node" />
|
||||
/** @internal */
|
||||
export declare function withCleanup<T extends object>(item: T, cleanup: (item: T) => void): T & Disposable;
|
||||
//# sourceMappingURL=withCleanup.d.ts.map
|
||||
14
graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/withCleanup.js
generated
vendored
Normal file
14
graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/withCleanup.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { __assign } from "tslib";
|
||||
/** @internal */
|
||||
export function withCleanup(item, cleanup) {
|
||||
var _a;
|
||||
return __assign(__assign({}, item), (_a = {}, _a[Symbol.dispose] = function () {
|
||||
cleanup(item);
|
||||
// if `item` already has a cleanup function, we also need to call the original cleanup function
|
||||
// (e.g. if something is wrapped in `withCleanup` twice)
|
||||
if (Symbol.dispose in item) {
|
||||
item[Symbol.dispose]();
|
||||
}
|
||||
}, _a));
|
||||
}
|
||||
//# sourceMappingURL=withCleanup.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/withCleanup.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/withCleanup.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"withCleanup.js","sourceRoot":"","sources":["../../../../src/testing/internal/disposables/withCleanup.ts"],"names":[],"mappings":";AAAA,gBAAgB;AAChB,MAAM,UAAU,WAAW,CACzB,IAAO,EACP,OAA0B;;IAE1B,6BACK,IAAI,aACP,GAAC,MAAM,CAAC,OAAO,IAAf;QACE,OAAO,CAAC,IAAI,CAAC,CAAC;QACd,+FAA+F;QAC/F,wDAAwD;QACxD,IAAI,MAAM,CAAC,OAAO,IAAI,IAAI,EAAE,CAAC;YAC1B,IAAmB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QACzC,CAAC;IACH,CAAC,OACD;AACJ,CAAC","sourcesContent":["/** @internal */\nexport function withCleanup<T extends object>(\n item: T,\n cleanup: (item: T) => void\n): T & Disposable {\n return {\n ...item,\n [Symbol.dispose]() {\n cleanup(item);\n // if `item` already has a cleanup function, we also need to call the original cleanup function\n // (e.g. if something is wrapped in `withCleanup` twice)\n if (Symbol.dispose in item) {\n (item as Disposable)[Symbol.dispose]();\n }\n },\n };\n}\n"]}
|
||||
8
graphql-subscription/node_modules/@apollo/client/testing/internal/index.d.ts
generated
vendored
Normal file
8
graphql-subscription/node_modules/@apollo/client/testing/internal/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export * from "./profile/index.js";
|
||||
export * from "./disposables/index.js";
|
||||
export { ObservableStream } from "./ObservableStream.js";
|
||||
export type { SimpleCaseData, PaginatedCaseData, PaginatedCaseVariables, VariablesCaseData, VariablesCaseVariables, } from "./scenarios/index.js";
|
||||
export { setupSimpleCase, setupVariablesCase, setupPaginatedCase, } from "./scenarios/index.js";
|
||||
export type { RenderWithClientOptions, RenderWithMocksOptions, } from "./renderHelpers.js";
|
||||
export { renderWithClient, renderWithMocks } from "./renderHelpers.js";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
6
graphql-subscription/node_modules/@apollo/client/testing/internal/index.js
generated
vendored
Normal file
6
graphql-subscription/node_modules/@apollo/client/testing/internal/index.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export * from "./profile/index.js";
|
||||
export * from "./disposables/index.js";
|
||||
export { ObservableStream } from "./ObservableStream.js";
|
||||
export { setupSimpleCase, setupVariablesCase, setupPaginatedCase, } from "./scenarios/index.js";
|
||||
export { renderWithClient, renderWithMocks } from "./renderHelpers.js";
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/internal/index.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/internal/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testing/internal/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AASzD,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["export * from \"./profile/index.js\";\nexport * from \"./disposables/index.js\";\nexport { ObservableStream } from \"./ObservableStream.js\";\n\nexport type {\n SimpleCaseData,\n PaginatedCaseData,\n PaginatedCaseVariables,\n VariablesCaseData,\n VariablesCaseVariables,\n} from \"./scenarios/index.js\";\nexport {\n setupSimpleCase,\n setupVariablesCase,\n setupPaginatedCase,\n} from \"./scenarios/index.js\";\n\nexport type {\n RenderWithClientOptions,\n RenderWithMocksOptions,\n} from \"./renderHelpers.js\";\nexport { renderWithClient, renderWithMocks } from \"./renderHelpers.js\";\n"]}
|
||||
171
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/Render.d.ts
generated
vendored
Normal file
171
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/Render.d.ts
generated
vendored
Normal file
@@ -0,0 +1,171 @@
|
||||
/// <reference types="react" />
|
||||
import { screen } from "@testing-library/dom";
|
||||
/** @internal */
|
||||
export interface BaseRender {
|
||||
id: string;
|
||||
phase: "mount" | "update" | "nested-update";
|
||||
actualDuration: number;
|
||||
baseDuration: number;
|
||||
startTime: number;
|
||||
commitTime: number;
|
||||
/**
|
||||
* The number of renders that have happened so far (including this render).
|
||||
*/
|
||||
count: number;
|
||||
}
|
||||
type Screen = typeof screen;
|
||||
/** @internal */
|
||||
export type SyncScreen = {
|
||||
[K in keyof Screen]: K extends `find${string}` ? {
|
||||
/** @deprecated A snapshot is static, so avoid async queries! */
|
||||
(...args: Parameters<Screen[K]>): ReturnType<Screen[K]>;
|
||||
} : Screen[K];
|
||||
};
|
||||
/** @internal */
|
||||
export interface Render<Snapshot> extends BaseRender {
|
||||
/**
|
||||
* The snapshot, as returned by the `takeSnapshot` option of `profile`.
|
||||
* (If using `profileHook`, this is the return value of the hook.)
|
||||
*/
|
||||
snapshot: Snapshot;
|
||||
/**
|
||||
* A DOM snapshot of the rendered component, if the `snapshotDOM`
|
||||
* option of `profile` was enabled.
|
||||
*/
|
||||
readonly domSnapshot: HTMLElement;
|
||||
/**
|
||||
* Returns a callback to receive a `screen` instance that is scoped to the
|
||||
* DOM snapshot of this `Render` instance.
|
||||
* Note: this is used as a callback to prevent linter errors.
|
||||
* @example
|
||||
* ```diff
|
||||
* const { withinDOM } = RenderedComponent.takeRender();
|
||||
* -expect(screen.getByText("foo")).toBeInTheDocument();
|
||||
* +expect(withinDOM().getByText("foo")).toBeInTheDocument();
|
||||
* ```
|
||||
*/
|
||||
withinDOM: () => SyncScreen;
|
||||
renderedComponents: Array<string | React.ComponentType>;
|
||||
}
|
||||
/** @internal */
|
||||
export declare class RenderInstance<Snapshot> implements Render<Snapshot> {
|
||||
snapshot: Snapshot;
|
||||
private stringifiedDOM;
|
||||
renderedComponents: Array<string | React.ComponentType>;
|
||||
id: string;
|
||||
phase: "mount" | "update" | "nested-update";
|
||||
actualDuration: number;
|
||||
baseDuration: number;
|
||||
startTime: number;
|
||||
commitTime: number;
|
||||
count: number;
|
||||
constructor(baseRender: BaseRender, snapshot: Snapshot, stringifiedDOM: string | undefined, renderedComponents: Array<string | React.ComponentType>);
|
||||
private _domSnapshot;
|
||||
get domSnapshot(): HTMLElement;
|
||||
get withinDOM(): () => {
|
||||
getByLabelText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined): T;
|
||||
getAllByLabelText<T_1 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined): T_1[];
|
||||
queryByLabelText<T_2 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined): T_2 | null;
|
||||
queryAllByLabelText<T_3 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined): T_3[];
|
||||
findByLabelText<T_4 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise<T_4>;
|
||||
findAllByLabelText<T_5 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise<T_5[]>;
|
||||
getByPlaceholderText<T_6 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_6;
|
||||
getAllByPlaceholderText<T_7 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_7[];
|
||||
queryByPlaceholderText<T_8 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_8 | null;
|
||||
queryAllByPlaceholderText<T_9 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_9[];
|
||||
findByPlaceholderText<T_10 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise<T_10>;
|
||||
findAllByPlaceholderText<T_11 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise<T_11[]>;
|
||||
getByText<T_12 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined): T_12;
|
||||
getAllByText<T_13 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined): T_13[];
|
||||
queryByText<T_14 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined): T_14 | null;
|
||||
queryAllByText<T_15 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined): T_15[];
|
||||
findByText<T_16 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise<T_16>;
|
||||
findAllByText<T_17 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise<T_17[]>;
|
||||
getByAltText<T_18 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_18;
|
||||
getAllByAltText<T_19 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_19[];
|
||||
queryByAltText<T_20 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_20 | null;
|
||||
queryAllByAltText<T_21 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_21[];
|
||||
findByAltText<T_22 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise<T_22>;
|
||||
findAllByAltText<T_23 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise<T_23[]>;
|
||||
getByTitle<T_24 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_24;
|
||||
getAllByTitle<T_25 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_25[];
|
||||
queryByTitle<T_26 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_26 | null;
|
||||
queryAllByTitle<T_27 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_27[];
|
||||
findByTitle<T_28 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise<T_28>;
|
||||
findAllByTitle<T_29 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise<T_29[]>;
|
||||
getByDisplayValue<T_30 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_30;
|
||||
getAllByDisplayValue<T_31 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_31[];
|
||||
queryByDisplayValue<T_32 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_32 | null;
|
||||
queryAllByDisplayValue<T_33 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_33[];
|
||||
findByDisplayValue<T_34 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise<T_34>;
|
||||
findAllByDisplayValue<T_35 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise<T_35[]>;
|
||||
getByRole<T_36 extends HTMLElement = HTMLElement>(role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined): T_36;
|
||||
getAllByRole<T_37 extends HTMLElement = HTMLElement>(role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined): T_37[];
|
||||
queryByRole<T_38 extends HTMLElement = HTMLElement>(role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined): T_38 | null;
|
||||
queryAllByRole<T_39 extends HTMLElement = HTMLElement>(role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined): T_39[];
|
||||
findByRole<T_40 extends HTMLElement = HTMLElement>(role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise<T_40>;
|
||||
findAllByRole<T_41 extends HTMLElement = HTMLElement>(role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise<T_41[]>;
|
||||
getByTestId<T_42 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_42;
|
||||
getAllByTestId<T_43 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_43[];
|
||||
queryByTestId<T_44 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_44 | null;
|
||||
queryAllByTestId<T_45 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_45[];
|
||||
findByTestId<T_46 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise<T_46>;
|
||||
findAllByTestId<T_47 extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise<T_47[]>;
|
||||
} & {
|
||||
getByLabelText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement;
|
||||
getAllByLabelText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement[];
|
||||
queryByLabelText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement | null;
|
||||
queryAllByLabelText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement[];
|
||||
findByLabelText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement>;
|
||||
findAllByLabelText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
||||
getByPlaceholderText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement;
|
||||
getAllByPlaceholderText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
|
||||
queryByPlaceholderText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement | null;
|
||||
queryAllByPlaceholderText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
|
||||
findByPlaceholderText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement>;
|
||||
findAllByPlaceholderText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
||||
getByText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement;
|
||||
getAllByText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement[];
|
||||
queryByText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement | null;
|
||||
queryAllByText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement[];
|
||||
findByText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement>;
|
||||
findAllByText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
||||
getByAltText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement;
|
||||
getAllByAltText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
|
||||
queryByAltText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement | null;
|
||||
queryAllByAltText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
|
||||
findByAltText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement>;
|
||||
findAllByAltText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
||||
getByTitle: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement;
|
||||
getAllByTitle: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
|
||||
queryByTitle: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement | null;
|
||||
queryAllByTitle: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
|
||||
findByTitle: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement>;
|
||||
findAllByTitle: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
||||
getByDisplayValue: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement;
|
||||
getAllByDisplayValue: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
|
||||
queryByDisplayValue: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement | null;
|
||||
queryAllByDisplayValue: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
|
||||
findByDisplayValue: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement>;
|
||||
findAllByDisplayValue: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
||||
getByRole: (role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined) => HTMLElement;
|
||||
getAllByRole: (role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined) => HTMLElement[];
|
||||
queryByRole: (role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined) => HTMLElement | null;
|
||||
queryAllByRole: (role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined) => HTMLElement[];
|
||||
findByRole: (role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement>;
|
||||
findAllByRole: (role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
||||
getByTestId: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement;
|
||||
getAllByTestId: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
|
||||
queryByTestId: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement | null;
|
||||
queryAllByTestId: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
|
||||
findByTestId: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement>;
|
||||
findAllByTestId: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
||||
} & {
|
||||
debug: (element?: Element | HTMLDocument | (Element | HTMLDocument)[] | undefined, maxLength?: number | undefined, options?: import("pretty-format").PrettyFormatOptions | undefined) => void;
|
||||
logTestingPlaygroundURL: (element?: Element | HTMLDocument | undefined) => void;
|
||||
};
|
||||
}
|
||||
/** @internal */
|
||||
export declare function errorOnDomInteraction(): void;
|
||||
export {};
|
||||
//# sourceMappingURL=Render.d.ts.map
|
||||
144
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/Render.js
generated
vendored
Normal file
144
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/Render.js
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
/* istanbul ignore file */
|
||||
import { __spreadArray } from "tslib";
|
||||
/*
|
||||
Something in this file does not compile correctly while measuring code coverage
|
||||
and will lead to a
|
||||
Uncaught [ReferenceError: cov_1zb8w312au is not defined]
|
||||
if we do not ignore this file in code coverage.
|
||||
|
||||
As we only use this file in our internal tests, we can safely ignore it.
|
||||
*/
|
||||
import { within, screen } from "@testing-library/dom";
|
||||
import { JSDOM, VirtualConsole } from "jsdom";
|
||||
import { applyStackTrace, captureStackTrace } from "./traces.js";
|
||||
/** @internal */
|
||||
var RenderInstance = /** @class */ (function () {
|
||||
function RenderInstance(baseRender, snapshot, stringifiedDOM, renderedComponents) {
|
||||
this.snapshot = snapshot;
|
||||
this.stringifiedDOM = stringifiedDOM;
|
||||
this.renderedComponents = renderedComponents;
|
||||
this.id = baseRender.id;
|
||||
this.phase = baseRender.phase;
|
||||
this.actualDuration = baseRender.actualDuration;
|
||||
this.baseDuration = baseRender.baseDuration;
|
||||
this.startTime = baseRender.startTime;
|
||||
this.commitTime = baseRender.commitTime;
|
||||
this.count = baseRender.count;
|
||||
}
|
||||
Object.defineProperty(RenderInstance.prototype, "domSnapshot", {
|
||||
get: function () {
|
||||
if (this._domSnapshot)
|
||||
return this._domSnapshot;
|
||||
if (!this.stringifiedDOM) {
|
||||
throw new Error("DOM snapshot is not available - please set the `snapshotDOM` option");
|
||||
}
|
||||
var virtualConsole = new VirtualConsole();
|
||||
var stackTrace = captureStackTrace("RenderInstance.get");
|
||||
virtualConsole.on("jsdomError", function (error) {
|
||||
throw applyStackTrace(error, stackTrace);
|
||||
});
|
||||
var snapDOM = new JSDOM(this.stringifiedDOM, {
|
||||
runScripts: "dangerously",
|
||||
virtualConsole: virtualConsole,
|
||||
});
|
||||
var document = snapDOM.window.document;
|
||||
var body = document.body;
|
||||
var script = document.createElement("script");
|
||||
script.type = "text/javascript";
|
||||
script.text = "\n ".concat(errorOnDomInteraction.toString(), ";\n ").concat(errorOnDomInteraction.name, "();\n ");
|
||||
body.appendChild(script);
|
||||
body.removeChild(script);
|
||||
return (this._domSnapshot = body);
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(RenderInstance.prototype, "withinDOM", {
|
||||
get: function () {
|
||||
var _this = this;
|
||||
var snapScreen = Object.assign(within(this.domSnapshot), {
|
||||
debug: function () {
|
||||
var _a = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
_a[_i] = arguments[_i];
|
||||
}
|
||||
var _b = _a[0], dom = _b === void 0 ? _this.domSnapshot : _b, rest = _a.slice(1);
|
||||
screen.debug.apply(screen, __spreadArray([dom], rest, false));
|
||||
},
|
||||
logTestingPlaygroundURL: function () {
|
||||
var _a = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
_a[_i] = arguments[_i];
|
||||
}
|
||||
var _b = _a[0], dom = _b === void 0 ? _this.domSnapshot : _b, rest = _a.slice(1);
|
||||
screen.logTestingPlaygroundURL.apply(screen, __spreadArray([dom], rest, false));
|
||||
},
|
||||
});
|
||||
return function () { return snapScreen; };
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
return RenderInstance;
|
||||
}());
|
||||
export { RenderInstance };
|
||||
/** @internal */
|
||||
export function errorOnDomInteraction() {
|
||||
var events = [
|
||||
"auxclick",
|
||||
"blur",
|
||||
"change",
|
||||
"click",
|
||||
"copy",
|
||||
"cut",
|
||||
"dblclick",
|
||||
"drag",
|
||||
"dragend",
|
||||
"dragenter",
|
||||
"dragleave",
|
||||
"dragover",
|
||||
"dragstart",
|
||||
"drop",
|
||||
"focus",
|
||||
"focusin",
|
||||
"focusout",
|
||||
"input",
|
||||
"keydown",
|
||||
"keypress",
|
||||
"keyup",
|
||||
"mousedown",
|
||||
"mouseenter",
|
||||
"mouseleave",
|
||||
"mousemove",
|
||||
"mouseout",
|
||||
"mouseover",
|
||||
"mouseup",
|
||||
"paste",
|
||||
"pointercancel",
|
||||
"pointerdown",
|
||||
"pointerenter",
|
||||
"pointerleave",
|
||||
"pointermove",
|
||||
"pointerout",
|
||||
"pointerover",
|
||||
"pointerup",
|
||||
"scroll",
|
||||
"select",
|
||||
"selectionchange",
|
||||
"selectstart",
|
||||
"submit",
|
||||
"toggle",
|
||||
"touchcancel",
|
||||
"touchend",
|
||||
"touchmove",
|
||||
"touchstart",
|
||||
"wheel",
|
||||
];
|
||||
function warnOnDomInteraction() {
|
||||
throw new Error("\n DOM interaction with a snapshot detected in test.\n Please don't interact with the DOM you get from `withinDOM`,\n but still use `screen' to get elements for simulating user interaction.\n ");
|
||||
}
|
||||
events.forEach(function (event) {
|
||||
document.addEventListener(event, warnOnDomInteraction);
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=Render.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/Render.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/Render.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
10
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/context.d.ts
generated
vendored
Normal file
10
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/context.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import * as React from "react";
|
||||
export interface ProfilerContextValue {
|
||||
renderedComponents: Array<React.ComponentType | string>;
|
||||
}
|
||||
export declare function ProfilerContextProvider({ children, value, }: {
|
||||
children: React.ReactNode;
|
||||
value: ProfilerContextValue;
|
||||
}): React.JSX.Element;
|
||||
export declare function useProfilerContext(): ProfilerContextValue | undefined;
|
||||
//# sourceMappingURL=context.d.ts.map
|
||||
14
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/context.js
generated
vendored
Normal file
14
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/context.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import * as React from "react";
|
||||
var ProfilerContext = React.createContext(undefined);
|
||||
export function ProfilerContextProvider(_a) {
|
||||
var children = _a.children, value = _a.value;
|
||||
var parentContext = useProfilerContext();
|
||||
if (parentContext) {
|
||||
throw new Error("Profilers should not be nested in the same tree");
|
||||
}
|
||||
return (React.createElement(ProfilerContext.Provider, { value: value }, children));
|
||||
}
|
||||
export function useProfilerContext() {
|
||||
return React.useContext(ProfilerContext);
|
||||
}
|
||||
//# sourceMappingURL=context.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/context.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/context.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/testing/internal/profile/context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,IAAM,eAAe,GAAG,KAAK,CAAC,aAAa,CACzC,SAAS,CACV,CAAC;AAEF,MAAM,UAAU,uBAAuB,CAAC,EAMvC;QALC,QAAQ,cAAA,EACR,KAAK,WAAA;IAKL,IAAM,aAAa,GAAG,kBAAkB,EAAE,CAAC;IAE3C,IAAI,aAAa,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IAED,OAAO,CACL,oBAAC,eAAe,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,IACnC,QAAQ,CACgB,CAC5B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,OAAO,KAAK,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["import * as React from \"react\";\n\nexport interface ProfilerContextValue {\n renderedComponents: Array<React.ComponentType | string>;\n}\n\nconst ProfilerContext = React.createContext<ProfilerContextValue | undefined>(\n undefined\n);\n\nexport function ProfilerContextProvider({\n children,\n value,\n}: {\n children: React.ReactNode;\n value: ProfilerContextValue;\n}) {\n const parentContext = useProfilerContext();\n\n if (parentContext) {\n throw new Error(\"Profilers should not be nested in the same tree\");\n }\n\n return (\n <ProfilerContext.Provider value={value}>\n {children}\n </ProfilerContext.Provider>\n );\n}\n\nexport function useProfilerContext() {\n return React.useContext(ProfilerContext);\n}\n"]}
|
||||
4
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/index.d.ts
generated
vendored
Normal file
4
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export type { NextRenderOptions, Profiler, ProfiledComponent, ProfiledHook, } from "./profile.js";
|
||||
export { createProfiler, profile, profileHook, useTrackRenders, WaitForRenderTimeoutError, } from "./profile.js";
|
||||
export type { SyncScreen } from "./Render.js";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
2
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/index.js
generated
vendored
Normal file
2
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { createProfiler, profile, profileHook, useTrackRenders, WaitForRenderTimeoutError, } from "./profile.js";
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/index.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/testing/internal/profile/index.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,cAAc,EACd,OAAO,EACP,WAAW,EACX,eAAe,EACf,yBAAyB,GAC1B,MAAM,cAAc,CAAC","sourcesContent":["export type {\n NextRenderOptions,\n Profiler,\n ProfiledComponent,\n ProfiledHook,\n} from \"./profile.js\";\nexport {\n createProfiler,\n profile,\n profileHook,\n useTrackRenders,\n WaitForRenderTimeoutError,\n} from \"./profile.js\";\n\nexport type { SyncScreen } from \"./Render.js\";\n"]}
|
||||
109
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/profile.d.ts
generated
vendored
Normal file
109
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/profile.d.ts
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
import * as React from "react";
|
||||
import type { Render, BaseRender } from "./Render.js";
|
||||
type ValidSnapshot = void | (object & {
|
||||
call?: never;
|
||||
});
|
||||
/** only used for passing around data internally */
|
||||
declare const _stackTrace: unique symbol;
|
||||
/** @internal */
|
||||
export interface NextRenderOptions {
|
||||
timeout?: number;
|
||||
[_stackTrace]?: string;
|
||||
}
|
||||
/** @internal */
|
||||
interface ProfilerProps {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
/** @internal */
|
||||
export interface Profiler<Snapshot> extends React.FC<ProfilerProps>, ProfiledComponentFields<Snapshot>, ProfiledComponentOnlyFields<Snapshot> {
|
||||
}
|
||||
interface ReplaceSnapshot<Snapshot> {
|
||||
(newSnapshot: Snapshot): void;
|
||||
(updateSnapshot: (lastSnapshot: Readonly<Snapshot>) => Snapshot): void;
|
||||
}
|
||||
interface MergeSnapshot<Snapshot> {
|
||||
(partialSnapshot: Partial<Snapshot>): void;
|
||||
(updatePartialSnapshot: (lastSnapshot: Readonly<Snapshot>) => Partial<Snapshot>): void;
|
||||
}
|
||||
interface ProfiledComponentOnlyFields<Snapshot> {
|
||||
mergeSnapshot: MergeSnapshot<Snapshot>;
|
||||
replaceSnapshot: ReplaceSnapshot<Snapshot>;
|
||||
}
|
||||
interface ProfiledComponentFields<Snapshot> {
|
||||
/**
|
||||
* An array of all renders that have happened so far.
|
||||
* Errors thrown during component render will be captured here, too.
|
||||
*/
|
||||
renders: Array<Render<Snapshot> | {
|
||||
phase: "snapshotError";
|
||||
count: number;
|
||||
error: unknown;
|
||||
}>;
|
||||
/**
|
||||
* Peeks the next render from the current iterator position, without advancing the iterator.
|
||||
* If no render has happened yet, it will wait for the next render to happen.
|
||||
* @throws {WaitForRenderTimeoutError} if no render happens within the timeout
|
||||
*/
|
||||
peekRender(options?: NextRenderOptions): Promise<Render<Snapshot>>;
|
||||
/**
|
||||
* Iterates to the next render and returns it.
|
||||
* If no render has happened yet, it will wait for the next render to happen.
|
||||
* @throws {WaitForRenderTimeoutError} if no render happens within the timeout
|
||||
*/
|
||||
takeRender(options?: NextRenderOptions): Promise<Render<Snapshot>>;
|
||||
/**
|
||||
* Returns the total number of renders.
|
||||
*/
|
||||
totalRenderCount(): number;
|
||||
/**
|
||||
* Returns the current render.
|
||||
* @throws {Error} if no render has happened yet
|
||||
*/
|
||||
getCurrentRender(): Render<Snapshot>;
|
||||
/**
|
||||
* Waits for the next render to happen.
|
||||
* Does not advance the render iterator.
|
||||
*/
|
||||
waitForNextRender(options?: NextRenderOptions): Promise<Render<Snapshot>>;
|
||||
}
|
||||
export interface ProfiledComponent<Snapshot extends ValidSnapshot, Props = {}> extends React.FC<Props>, ProfiledComponentFields<Snapshot>, ProfiledComponentOnlyFields<Snapshot> {
|
||||
}
|
||||
/** @internal */
|
||||
export declare function profile<Snapshot extends ValidSnapshot = void, Props = {}>({ Component, ...options }: Parameters<typeof createProfiler<Snapshot>>[0] & {
|
||||
Component: React.ComponentType<Props>;
|
||||
}): ProfiledComponent<Snapshot, Props>;
|
||||
/** @internal */
|
||||
export declare function createProfiler<Snapshot extends ValidSnapshot = void>({ onRender, snapshotDOM, initialSnapshot, skipNonTrackingRenders, }?: {
|
||||
onRender?: (info: BaseRender & {
|
||||
snapshot: Snapshot;
|
||||
replaceSnapshot: ReplaceSnapshot<Snapshot>;
|
||||
mergeSnapshot: MergeSnapshot<Snapshot>;
|
||||
}) => void;
|
||||
snapshotDOM?: boolean;
|
||||
initialSnapshot?: Snapshot;
|
||||
/**
|
||||
* This will skip renders during which no renders tracked by
|
||||
* `useTrackRenders` occured.
|
||||
*/
|
||||
skipNonTrackingRenders?: boolean;
|
||||
}): Profiler<Snapshot>;
|
||||
/** @internal */
|
||||
export declare class WaitForRenderTimeoutError extends Error {
|
||||
constructor();
|
||||
}
|
||||
type StringReplaceRenderWithSnapshot<T extends string> = T extends `${infer Pre}Render${infer Post}` ? `${Pre}Snapshot${Post}` : T;
|
||||
type ResultReplaceRenderWithSnapshot<T> = T extends (...args: infer Args) => Render<infer Snapshot> ? (...args: Args) => Snapshot : T extends (...args: infer Args) => Promise<Render<infer Snapshot>> ? (...args: Args) => Promise<Snapshot> : T;
|
||||
type ProfiledHookFields<ReturnValue> = ProfiledComponentFields<ReturnValue> extends infer PC ? {
|
||||
[K in keyof PC as StringReplaceRenderWithSnapshot<K & string>]: ResultReplaceRenderWithSnapshot<PC[K]>;
|
||||
} : never;
|
||||
/** @internal */
|
||||
export interface ProfiledHook<Props, ReturnValue> extends React.FC<Props>, ProfiledHookFields<ReturnValue> {
|
||||
Profiler: Profiler<ReturnValue>;
|
||||
}
|
||||
/** @internal */
|
||||
export declare function profileHook<ReturnValue extends ValidSnapshot, Props>(renderCallback: (props: Props) => ReturnValue): ProfiledHook<Props, ReturnValue>;
|
||||
export declare function useTrackRenders({ name }?: {
|
||||
name?: string;
|
||||
}): void;
|
||||
export {};
|
||||
//# sourceMappingURL=profile.d.ts.map
|
||||
296
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/profile.js
generated
vendored
Normal file
296
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/profile.js
generated
vendored
Normal file
@@ -0,0 +1,296 @@
|
||||
var _a, _b;
|
||||
import { __addDisposableResource, __assign, __awaiter, __disposeResources, __extends, __generator, __rest } from "tslib";
|
||||
import * as React from "react";
|
||||
import { TextEncoder, TextDecoder } from "util";
|
||||
(_a = global.TextEncoder) !== null && _a !== void 0 ? _a : (global.TextEncoder = TextEncoder);
|
||||
// @ts-ignore
|
||||
(_b = global.TextDecoder) !== null && _b !== void 0 ? _b : (global.TextDecoder = TextDecoder);
|
||||
import { RenderInstance } from "./Render.js";
|
||||
import { applyStackTrace, captureStackTrace } from "./traces.js";
|
||||
import { ProfilerContextProvider, useProfilerContext } from "./context.js";
|
||||
import { disableActWarnings } from "../disposables/index.js";
|
||||
/** only used for passing around data internally */
|
||||
var _stackTrace = Symbol();
|
||||
/** @internal */
|
||||
export function profile(_a) {
|
||||
var Component = _a.Component, options = __rest(_a, ["Component"]);
|
||||
var Profiler = createProfiler(options);
|
||||
return Object.assign(function ProfiledComponent(props) {
|
||||
return (React.createElement(Profiler, null,
|
||||
React.createElement(Component, __assign({}, props))));
|
||||
}, {
|
||||
mergeSnapshot: Profiler.mergeSnapshot,
|
||||
replaceSnapshot: Profiler.replaceSnapshot,
|
||||
getCurrentRender: Profiler.getCurrentRender,
|
||||
peekRender: Profiler.peekRender,
|
||||
takeRender: Profiler.takeRender,
|
||||
totalRenderCount: Profiler.totalRenderCount,
|
||||
waitForNextRender: Profiler.waitForNextRender,
|
||||
get renders() {
|
||||
return Profiler.renders;
|
||||
},
|
||||
});
|
||||
}
|
||||
/** @internal */
|
||||
export function createProfiler(_a) {
|
||||
var _b = _a === void 0 ? {} : _a, onRender = _b.onRender, _c = _b.snapshotDOM, snapshotDOM = _c === void 0 ? false : _c, initialSnapshot = _b.initialSnapshot, skipNonTrackingRenders = _b.skipNonTrackingRenders;
|
||||
var nextRender;
|
||||
var resolveNextRender;
|
||||
var rejectNextRender;
|
||||
var snapshotRef = { current: initialSnapshot };
|
||||
var replaceSnapshot = function (snap) {
|
||||
if (typeof snap === "function") {
|
||||
if (!initialSnapshot) {
|
||||
throw new Error("Cannot use a function to update the snapshot if no initial snapshot was provided.");
|
||||
}
|
||||
snapshotRef.current = snap(typeof snapshotRef.current === "object" ? __assign({}, snapshotRef.current) : snapshotRef.current);
|
||||
}
|
||||
else {
|
||||
snapshotRef.current = snap;
|
||||
}
|
||||
};
|
||||
var mergeSnapshot = function (partialSnapshot) {
|
||||
replaceSnapshot(function (snapshot) { return (__assign(__assign({}, snapshot), (typeof partialSnapshot === "function" ?
|
||||
partialSnapshot(snapshot)
|
||||
: partialSnapshot))); });
|
||||
};
|
||||
var profilerContext = {
|
||||
renderedComponents: [],
|
||||
};
|
||||
var profilerOnRender = function (id, phase, actualDuration, baseDuration, startTime, commitTime) {
|
||||
if (skipNonTrackingRenders &&
|
||||
profilerContext.renderedComponents.length === 0) {
|
||||
return;
|
||||
}
|
||||
var baseRender = {
|
||||
id: id,
|
||||
phase: phase,
|
||||
actualDuration: actualDuration,
|
||||
baseDuration: baseDuration,
|
||||
startTime: startTime,
|
||||
commitTime: commitTime,
|
||||
count: Profiler.renders.length + 1,
|
||||
};
|
||||
try {
|
||||
/*
|
||||
* The `onRender` function could contain `expect` calls that throw
|
||||
* `JestAssertionError`s - but we are still inside of React, where errors
|
||||
* might be swallowed.
|
||||
* So we record them and re-throw them in `takeRender`
|
||||
* Additionally, we reject the `waitForNextRender` promise.
|
||||
*/
|
||||
onRender === null || onRender === void 0 ? void 0 : onRender(__assign(__assign({}, baseRender), { replaceSnapshot: replaceSnapshot, mergeSnapshot: mergeSnapshot, snapshot: snapshotRef.current }));
|
||||
var snapshot = snapshotRef.current;
|
||||
var domSnapshot = snapshotDOM ? window.document.body.innerHTML : undefined;
|
||||
var render = new RenderInstance(baseRender, snapshot, domSnapshot, profilerContext.renderedComponents);
|
||||
profilerContext.renderedComponents = [];
|
||||
Profiler.renders.push(render);
|
||||
resolveNextRender === null || resolveNextRender === void 0 ? void 0 : resolveNextRender(render);
|
||||
}
|
||||
catch (error) {
|
||||
Profiler.renders.push({
|
||||
phase: "snapshotError",
|
||||
count: Profiler.renders.length,
|
||||
error: error,
|
||||
});
|
||||
rejectNextRender === null || rejectNextRender === void 0 ? void 0 : rejectNextRender(error);
|
||||
}
|
||||
finally {
|
||||
nextRender = resolveNextRender = rejectNextRender = undefined;
|
||||
}
|
||||
};
|
||||
var iteratorPosition = 0;
|
||||
var Profiler = Object.assign(function (_a) {
|
||||
var children = _a.children;
|
||||
return (React.createElement(ProfilerContextProvider, { value: profilerContext },
|
||||
React.createElement(React.Profiler, { id: "test", onRender: profilerOnRender }, children)));
|
||||
}, {
|
||||
replaceSnapshot: replaceSnapshot,
|
||||
mergeSnapshot: mergeSnapshot,
|
||||
}, {
|
||||
renders: new Array(),
|
||||
totalRenderCount: function () {
|
||||
return Profiler.renders.length;
|
||||
},
|
||||
peekRender: function (options) {
|
||||
if (options === void 0) { options = {}; }
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var render;
|
||||
var _a;
|
||||
return __generator(this, function (_b) {
|
||||
if (iteratorPosition < Profiler.renders.length) {
|
||||
render = Profiler.renders[iteratorPosition];
|
||||
if (render.phase === "snapshotError") {
|
||||
throw render.error;
|
||||
}
|
||||
return [2 /*return*/, render];
|
||||
}
|
||||
return [2 /*return*/, Profiler.waitForNextRender(__assign((_a = {}, _a[_stackTrace] = captureStackTrace(Profiler.peekRender), _a), options))];
|
||||
});
|
||||
});
|
||||
},
|
||||
takeRender: function (options) {
|
||||
if (options === void 0) { options = {}; }
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var env_1, _disabledActWarnings, error, e_1, e_2;
|
||||
var _a;
|
||||
return __generator(this, function (_b) {
|
||||
switch (_b.label) {
|
||||
case 0:
|
||||
env_1 = { stack: [], error: void 0, hasError: false };
|
||||
_b.label = 1;
|
||||
case 1:
|
||||
_b.trys.push([1, 7, 8, 9]);
|
||||
_disabledActWarnings = __addDisposableResource(env_1, disableActWarnings(), false);
|
||||
error = undefined;
|
||||
_b.label = 2;
|
||||
case 2:
|
||||
_b.trys.push([2, 4, 5, 6]);
|
||||
return [4 /*yield*/, Profiler.peekRender(__assign((_a = {}, _a[_stackTrace] = captureStackTrace(Profiler.takeRender), _a), options))];
|
||||
case 3: return [2 /*return*/, _b.sent()];
|
||||
case 4:
|
||||
e_1 = _b.sent();
|
||||
error = e_1;
|
||||
throw e_1;
|
||||
case 5:
|
||||
if (!(error && error instanceof WaitForRenderTimeoutError)) {
|
||||
iteratorPosition++;
|
||||
}
|
||||
return [7 /*endfinally*/];
|
||||
case 6: return [3 /*break*/, 9];
|
||||
case 7:
|
||||
e_2 = _b.sent();
|
||||
env_1.error = e_2;
|
||||
env_1.hasError = true;
|
||||
return [3 /*break*/, 9];
|
||||
case 8:
|
||||
__disposeResources(env_1);
|
||||
return [7 /*endfinally*/];
|
||||
case 9: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
getCurrentRender: function () {
|
||||
// The "current" render should point at the same render that the most
|
||||
// recent `takeRender` call returned, so we need to get the "previous"
|
||||
// iterator position, otherwise `takeRender` advances the iterator
|
||||
// to the next render. This means we need to call `takeRender` at least
|
||||
// once before we can get a current render.
|
||||
var currentPosition = iteratorPosition - 1;
|
||||
if (currentPosition < 0) {
|
||||
throw new Error("No current render available. You need to call `takeRender` before you can get the current render.");
|
||||
}
|
||||
var render = Profiler.renders[currentPosition];
|
||||
if (render.phase === "snapshotError") {
|
||||
throw render.error;
|
||||
}
|
||||
return render;
|
||||
},
|
||||
waitForNextRender: function (_a) {
|
||||
var _b = _a === void 0 ? {} : _a, _c = _b.timeout, timeout = _c === void 0 ? 1000 : _c,
|
||||
// capture the stack trace here so its stack trace is as close to the calling code as possible
|
||||
_d = _stackTrace,
|
||||
// capture the stack trace here so its stack trace is as close to the calling code as possible
|
||||
_e = _b[_d],
|
||||
// capture the stack trace here so its stack trace is as close to the calling code as possible
|
||||
stackTrace = _e === void 0 ? captureStackTrace(Profiler.waitForNextRender) : _e;
|
||||
if (!nextRender) {
|
||||
nextRender = Promise.race([
|
||||
new Promise(function (resolve, reject) {
|
||||
resolveNextRender = resolve;
|
||||
rejectNextRender = reject;
|
||||
}),
|
||||
new Promise(function (_, reject) {
|
||||
return setTimeout(function () {
|
||||
return reject(applyStackTrace(new WaitForRenderTimeoutError(), stackTrace));
|
||||
}, timeout);
|
||||
}),
|
||||
]);
|
||||
}
|
||||
return nextRender;
|
||||
},
|
||||
});
|
||||
return Profiler;
|
||||
}
|
||||
/** @internal */
|
||||
var WaitForRenderTimeoutError = /** @class */ (function (_super) {
|
||||
__extends(WaitForRenderTimeoutError, _super);
|
||||
function WaitForRenderTimeoutError() {
|
||||
var _newTarget = this.constructor;
|
||||
var _this = _super.call(this, "Exceeded timeout waiting for next render.") || this;
|
||||
Object.setPrototypeOf(_this, _newTarget.prototype);
|
||||
return _this;
|
||||
}
|
||||
return WaitForRenderTimeoutError;
|
||||
}(Error));
|
||||
export { WaitForRenderTimeoutError };
|
||||
/** @internal */
|
||||
export function profileHook(renderCallback) {
|
||||
var Profiler = createProfiler();
|
||||
var ProfiledHook = function (props) {
|
||||
Profiler.replaceSnapshot(renderCallback(props));
|
||||
return null;
|
||||
};
|
||||
return Object.assign(function App(props) {
|
||||
return (React.createElement(Profiler, null,
|
||||
React.createElement(ProfiledHook, __assign({}, props))));
|
||||
}, {
|
||||
Profiler: Profiler,
|
||||
}, {
|
||||
renders: Profiler.renders,
|
||||
totalSnapshotCount: Profiler.totalRenderCount,
|
||||
peekSnapshot: function (options) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, Profiler.peekRender(options)];
|
||||
case 1: return [2 /*return*/, (_a.sent()).snapshot];
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
takeSnapshot: function (options) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, Profiler.takeRender(options)];
|
||||
case 1: return [2 /*return*/, (_a.sent()).snapshot];
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
getCurrentSnapshot: function () {
|
||||
return Profiler.getCurrentRender().snapshot;
|
||||
},
|
||||
waitForNextSnapshot: function (options) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, Profiler.waitForNextRender(options)];
|
||||
case 1: return [2 /*return*/, (_a.sent()).snapshot];
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
function resolveHookOwner() {
|
||||
var _a, _b, _c;
|
||||
return (_c = (_b = (_a = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _a === void 0 ? void 0 : _a.ReactCurrentOwner) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.elementType;
|
||||
}
|
||||
export function useTrackRenders(_a) {
|
||||
var _b = _a === void 0 ? {} : _a, name = _b.name;
|
||||
var component = name || resolveHookOwner();
|
||||
if (!component) {
|
||||
throw new Error("useTrackRender: Unable to determine component. Please ensure the hook is called inside a rendered component or provide a `name` option.");
|
||||
}
|
||||
var ctx = useProfilerContext();
|
||||
if (!ctx) {
|
||||
throw new Error("useTrackComponentRender: A Profiler must be created and rendered to track component renders");
|
||||
}
|
||||
React.useLayoutEffect(function () {
|
||||
ctx.renderedComponents.unshift(component);
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=profile.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/profile.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/profile.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/traces.d.ts
generated
vendored
Normal file
7
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/traces.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Captures a StackTrace and (if passed) cuts off
|
||||
* the first lines including the calling function.
|
||||
*/
|
||||
export declare function captureStackTrace(callingFunction?: string | (() => {})): string;
|
||||
export declare function applyStackTrace(error: Error, stackTrace: string): Error;
|
||||
//# sourceMappingURL=traces.d.ts.map
|
||||
30
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/traces.js
generated
vendored
Normal file
30
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/traces.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Captures a StackTrace and (if passed) cuts off
|
||||
* the first lines including the calling function.
|
||||
*/
|
||||
export function captureStackTrace(callingFunction) {
|
||||
var stack = "";
|
||||
try {
|
||||
throw new Error("");
|
||||
}
|
||||
catch (e) {
|
||||
(stack = e.stack);
|
||||
}
|
||||
var callerName = typeof callingFunction === "string" ? callingFunction
|
||||
: callingFunction ? callingFunction.name
|
||||
: undefined;
|
||||
if (callerName && stack.includes(callerName)) {
|
||||
var lines = stack.split("\n");
|
||||
stack = lines
|
||||
.slice(
|
||||
// @ts-expect-error this is too old of a TS target, but node has it
|
||||
lines.findLastIndex(function (line) { return line.includes(callerName); }) + 1)
|
||||
.join("\n");
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
export function applyStackTrace(error, stackTrace) {
|
||||
error.stack = error.message + "\n" + stackTrace;
|
||||
return error;
|
||||
}
|
||||
//# sourceMappingURL=traces.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/traces.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/internal/profile/traces.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"traces.js","sourceRoot":"","sources":["../../../../src/testing/internal/profile/traces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,eAAqC;IACrE,IAAI,KAAK,GAAG,EAAE,CAAC;IACf,IAAI,CAAC;QACH,MAAM,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC;IACtB,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,CAAG,KAAK,GAAK,CAAC,MAAN,CAAO,CAAC;IAClB,CAAC;IAED,IAAM,UAAU,GACd,OAAO,eAAe,KAAK,QAAQ,CAAC,CAAC,CAAC,eAAe;QACrD,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI;YACxC,CAAC,CAAC,SAAS,CAAC;IAEd,IAAI,UAAU,IAAI,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7C,IAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEhC,KAAK,GAAG,KAAK;aACV,KAAK;QACJ,mEAAmE;QACnE,KAAK,CAAC,aAAa,CAAC,UAAC,IAAY,IAAK,OAAA,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAzB,CAAyB,CAAC,GAAG,CAAC,CACrE;aACA,IAAI,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,KAAY,EAAE,UAAkB;IAC9D,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,IAAI,GAAG,UAAU,CAAC;IAChD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/**\n * Captures a StackTrace and (if passed) cuts off\n * the first lines including the calling function.\n */\nexport function captureStackTrace(callingFunction?: string | (() => {})) {\n let stack = \"\";\n try {\n throw new Error(\"\");\n } catch (e: any) {\n ({ stack } = e);\n }\n\n const callerName =\n typeof callingFunction === \"string\" ? callingFunction\n : callingFunction ? callingFunction.name\n : undefined;\n\n if (callerName && stack.includes(callerName)) {\n const lines = stack.split(\"\\n\");\n\n stack = lines\n .slice(\n // @ts-expect-error this is too old of a TS target, but node has it\n lines.findLastIndex((line: string) => line.includes(callerName)) + 1\n )\n .join(\"\\n\");\n }\n\n return stack;\n}\n\nexport function applyStackTrace(error: Error, stackTrace: string) {\n error.stack = error.message + \"\\n\" + stackTrace;\n return error;\n}\n"]}
|
||||
12
graphql-subscription/node_modules/@apollo/client/testing/internal/renderHelpers.d.ts
generated
vendored
Normal file
12
graphql-subscription/node_modules/@apollo/client/testing/internal/renderHelpers.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { ReactElement } from "react";
|
||||
import type { Queries, RenderOptions, queries } from "@testing-library/react";
|
||||
import type { ApolloClient } from "../../core/index.js";
|
||||
import type { MockedProviderProps } from "../react/MockedProvider.js";
|
||||
export interface RenderWithClientOptions<Q extends Queries = typeof queries, Container extends Element | DocumentFragment = HTMLElement, BaseElement extends Element | DocumentFragment = Container> extends RenderOptions<Q, Container, BaseElement> {
|
||||
client: ApolloClient<any>;
|
||||
}
|
||||
export declare function renderWithClient<Q extends Queries = typeof queries, Container extends Element | DocumentFragment = HTMLElement, BaseElement extends Element | DocumentFragment = Container>(ui: ReactElement, { client, wrapper: Wrapper, ...renderOptions }: RenderWithClientOptions<Q, Container, BaseElement>): import("@testing-library/react").RenderResult<Q, Container, BaseElement>;
|
||||
export interface RenderWithMocksOptions<Q extends Queries = typeof queries, Container extends Element | DocumentFragment = HTMLElement, BaseElement extends Element | DocumentFragment = Container> extends RenderOptions<Q, Container, BaseElement>, MockedProviderProps<any> {
|
||||
}
|
||||
export declare function renderWithMocks<Q extends Queries = typeof queries, Container extends Element | DocumentFragment = HTMLElement, BaseElement extends Element | DocumentFragment = Container>(ui: ReactElement, { wrapper: Wrapper, ...renderOptions }: RenderWithMocksOptions<Q, Container, BaseElement>): import("@testing-library/react").RenderResult<Q, Container, BaseElement>;
|
||||
//# sourceMappingURL=renderHelpers.d.ts.map
|
||||
22
graphql-subscription/node_modules/@apollo/client/testing/internal/renderHelpers.js
generated
vendored
Normal file
22
graphql-subscription/node_modules/@apollo/client/testing/internal/renderHelpers.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import { __assign, __rest } from "tslib";
|
||||
import * as React from "react";
|
||||
import { render } from "@testing-library/react";
|
||||
import { ApolloProvider } from "../../react/index.js";
|
||||
import { MockedProvider } from "../react/MockedProvider.js";
|
||||
export function renderWithClient(ui, _a) {
|
||||
var client = _a.client, _b = _a.wrapper, Wrapper = _b === void 0 ? React.Fragment : _b, renderOptions = __rest(_a, ["client", "wrapper"]);
|
||||
return render(ui, __assign(__assign({}, renderOptions), { wrapper: function (_a) {
|
||||
var children = _a.children;
|
||||
return (React.createElement(ApolloProvider, { client: client },
|
||||
React.createElement(Wrapper, null, children)));
|
||||
} }));
|
||||
}
|
||||
export function renderWithMocks(ui, _a) {
|
||||
var _b = _a.wrapper, Wrapper = _b === void 0 ? React.Fragment : _b, renderOptions = __rest(_a, ["wrapper"]);
|
||||
return render(ui, __assign(__assign({}, renderOptions), { wrapper: function (_a) {
|
||||
var children = _a.children;
|
||||
return (React.createElement(MockedProvider, __assign({}, renderOptions),
|
||||
React.createElement(Wrapper, null, children)));
|
||||
} }));
|
||||
}
|
||||
//# sourceMappingURL=renderHelpers.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/internal/renderHelpers.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/internal/renderHelpers.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"renderHelpers.js","sourceRoot":"","sources":["../../../src/testing/internal/renderHelpers.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGhD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAU5D,MAAM,UAAU,gBAAgB,CAK9B,EAAgB,EAChB,EAIqD;IAHnD,IAAA,MAAM,YAAA,EACN,eAAiC,EAAxB,OAAO,mBAAG,KAAK,CAAC,QAAQ,KAAA,EAC9B,aAAa,cAHlB,qBAIC,CADiB;IAGlB,OAAO,MAAM,CAAC,EAAE,wBACX,aAAa,KAChB,OAAO,EAAE,UAAC,EAAY;gBAAV,QAAQ,cAAA;YAClB,OAAO,CACL,oBAAC,cAAc,IAAC,MAAM,EAAE,MAAM;gBAC5B,oBAAC,OAAO,QAAE,QAAQ,CAAW,CACd,CAClB,CAAC;QACJ,CAAC,IACD,CAAC;AACL,CAAC;AASD,MAAM,UAAU,eAAe,CAK7B,EAAgB,EAChB,EAGoD;IAFlD,IAAA,eAAiC,EAAxB,OAAO,mBAAG,KAAK,CAAC,QAAQ,KAAA,EAC9B,aAAa,cAFlB,WAGC,CADiB;IAGlB,OAAO,MAAM,CAAC,EAAE,wBACX,aAAa,KAChB,OAAO,EAAE,UAAC,EAAY;gBAAV,QAAQ,cAAA;YAClB,OAAO,CACL,oBAAC,cAAc,eAAK,aAAa;gBAC/B,oBAAC,OAAO,QAAE,QAAQ,CAAW,CACd,CAClB,CAAC;QACJ,CAAC,IACD,CAAC;AACL,CAAC","sourcesContent":["import * as React from \"react\";\nimport type { ReactElement } from \"react\";\nimport { render } from \"@testing-library/react\";\nimport type { Queries, RenderOptions, queries } from \"@testing-library/react\";\nimport type { ApolloClient } from \"../../core/index.js\";\nimport { ApolloProvider } from \"../../react/index.js\";\nimport type { MockedProviderProps } from \"../react/MockedProvider.js\";\nimport { MockedProvider } from \"../react/MockedProvider.js\";\n\nexport interface RenderWithClientOptions<\n Q extends Queries = typeof queries,\n Container extends Element | DocumentFragment = HTMLElement,\n BaseElement extends Element | DocumentFragment = Container,\n> extends RenderOptions<Q, Container, BaseElement> {\n client: ApolloClient<any>;\n}\n\nexport function renderWithClient<\n Q extends Queries = typeof queries,\n Container extends Element | DocumentFragment = HTMLElement,\n BaseElement extends Element | DocumentFragment = Container,\n>(\n ui: ReactElement,\n {\n client,\n wrapper: Wrapper = React.Fragment,\n ...renderOptions\n }: RenderWithClientOptions<Q, Container, BaseElement>\n) {\n return render(ui, {\n ...renderOptions,\n wrapper: ({ children }) => {\n return (\n <ApolloProvider client={client}>\n <Wrapper>{children}</Wrapper>\n </ApolloProvider>\n );\n },\n });\n}\n\nexport interface RenderWithMocksOptions<\n Q extends Queries = typeof queries,\n Container extends Element | DocumentFragment = HTMLElement,\n BaseElement extends Element | DocumentFragment = Container,\n> extends RenderOptions<Q, Container, BaseElement>,\n MockedProviderProps<any> {}\n\nexport function renderWithMocks<\n Q extends Queries = typeof queries,\n Container extends Element | DocumentFragment = HTMLElement,\n BaseElement extends Element | DocumentFragment = Container,\n>(\n ui: ReactElement,\n {\n wrapper: Wrapper = React.Fragment,\n ...renderOptions\n }: RenderWithMocksOptions<Q, Container, BaseElement>\n) {\n return render(ui, {\n ...renderOptions,\n wrapper: ({ children }) => {\n return (\n <MockedProvider {...renderOptions}>\n <Wrapper>{children}</Wrapper>\n </MockedProvider>\n );\n },\n });\n}\n"]}
|
||||
41
graphql-subscription/node_modules/@apollo/client/testing/internal/scenarios/index.d.ts
generated
vendored
Normal file
41
graphql-subscription/node_modules/@apollo/client/testing/internal/scenarios/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
import { ApolloLink } from "../../../core/index.js";
|
||||
import type { TypedDocumentNode } from "../../../core/index.js";
|
||||
import type { MockedResponse } from "../../core/index.js";
|
||||
export interface SimpleCaseData {
|
||||
greeting: string;
|
||||
}
|
||||
export declare function setupSimpleCase(): {
|
||||
query: TypedDocumentNode<SimpleCaseData, Record<string, never>>;
|
||||
mocks: MockedResponse<SimpleCaseData, Record<string, any>>[];
|
||||
};
|
||||
export interface VariablesCaseData {
|
||||
character: {
|
||||
__typename: "Character";
|
||||
id: string;
|
||||
name: string;
|
||||
};
|
||||
}
|
||||
export interface VariablesCaseVariables {
|
||||
id: string;
|
||||
}
|
||||
export declare function setupVariablesCase(): {
|
||||
mocks: MockedResponse<VariablesCaseData, Record<string, any>>[];
|
||||
query: TypedDocumentNode<VariablesCaseData, VariablesCaseVariables>;
|
||||
};
|
||||
interface Letter {
|
||||
letter: string;
|
||||
position: number;
|
||||
}
|
||||
export interface PaginatedCaseData {
|
||||
letters: Letter[];
|
||||
}
|
||||
export interface PaginatedCaseVariables {
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
}
|
||||
export declare function setupPaginatedCase(): {
|
||||
query: TypedDocumentNode<PaginatedCaseData, PaginatedCaseVariables>;
|
||||
link: ApolloLink;
|
||||
};
|
||||
export {};
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
48
graphql-subscription/node_modules/@apollo/client/testing/internal/scenarios/index.js
generated
vendored
Normal file
48
graphql-subscription/node_modules/@apollo/client/testing/internal/scenarios/index.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
import { __makeTemplateObject, __spreadArray } from "tslib";
|
||||
import { ApolloLink, Observable, gql } from "../../../core/index.js";
|
||||
export function setupSimpleCase() {
|
||||
var query = gql(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n query GreetingQuery {\n greeting\n }\n "], ["\n query GreetingQuery {\n greeting\n }\n "])));
|
||||
var mocks = [
|
||||
{
|
||||
request: { query: query },
|
||||
result: { data: { greeting: "Hello" } },
|
||||
delay: 10,
|
||||
},
|
||||
];
|
||||
return { query: query, mocks: mocks };
|
||||
}
|
||||
export function setupVariablesCase() {
|
||||
var query = gql(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n query CharacterQuery($id: ID!) {\n character(id: $id) {\n id\n name\n }\n }\n "], ["\n query CharacterQuery($id: ID!) {\n character(id: $id) {\n id\n name\n }\n }\n "])));
|
||||
var CHARACTERS = ["Spider-Man", "Black Widow", "Iron Man", "Hulk"];
|
||||
var mocks = __spreadArray([], CHARACTERS, true).map(function (name, index) { return ({
|
||||
request: { query: query, variables: { id: String(index + 1) } },
|
||||
result: {
|
||||
data: {
|
||||
character: { __typename: "Character", id: String(index + 1), name: name },
|
||||
},
|
||||
},
|
||||
delay: 20,
|
||||
}); });
|
||||
return { mocks: mocks, query: query };
|
||||
}
|
||||
export function setupPaginatedCase() {
|
||||
var query = gql(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n query letters($limit: Int, $offset: Int) {\n letters(limit: $limit) {\n letter\n position\n }\n }\n "], ["\n query letters($limit: Int, $offset: Int) {\n letters(limit: $limit) {\n letter\n position\n }\n }\n "])));
|
||||
var data = "ABCDEFGHIJKLMNOPQRSTUV".split("").map(function (letter, index) { return ({
|
||||
__typename: "Letter",
|
||||
letter: letter,
|
||||
position: index + 1,
|
||||
}); });
|
||||
var link = new ApolloLink(function (operation) {
|
||||
var _a = operation.variables, _b = _a.offset, offset = _b === void 0 ? 0 : _b, _c = _a.limit, limit = _c === void 0 ? 2 : _c;
|
||||
var letters = data.slice(offset, offset + limit);
|
||||
return new Observable(function (observer) {
|
||||
setTimeout(function () {
|
||||
observer.next({ data: { letters: letters } });
|
||||
observer.complete();
|
||||
}, 10);
|
||||
});
|
||||
});
|
||||
return { query: query, link: link };
|
||||
}
|
||||
var templateObject_1, templateObject_2, templateObject_3;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/internal/scenarios/index.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/internal/scenarios/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/testing/internal/scenarios/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAQrE,MAAM,UAAU,eAAe;IAC7B,IAAM,KAAK,GAA6D,GAAG,2HAAA,wDAI1E,IAAA,CAAC;IAEF,IAAM,KAAK,GAAqC;QAC9C;YACE,OAAO,EAAE,EAAE,KAAK,OAAA,EAAE;YAClB,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;YACvC,KAAK,EAAE,EAAE;SACV;KACF,CAAC;IAEF,OAAO,EAAE,KAAK,OAAA,EAAE,KAAK,OAAA,EAAE,CAAC;AAC1B,CAAC;AAcD,MAAM,UAAU,kBAAkB;IAChC,IAAM,KAAK,GACT,GAAG,mMAAA,gIAOF,IAAA,CAAC;IACJ,IAAM,UAAU,GAAG,CAAC,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IAErE,IAAM,KAAK,GAAwC,kBAAI,UAAU,QAAE,GAAG,CACpE,UAAC,IAAI,EAAE,KAAK,IAAK,OAAA,CAAC;QAChB,OAAO,EAAE,EAAE,KAAK,OAAA,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,EAAE;QACxD,MAAM,EAAE;YACN,IAAI,EAAE;gBACJ,SAAS,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,IAAI,MAAA,EAAE;aACpE;SACF;QACD,KAAK,EAAE,EAAE;KACV,CAAC,EARe,CAQf,CACH,CAAC;IAEF,OAAO,EAAE,KAAK,OAAA,EAAE,KAAK,OAAA,EAAE,CAAC;AAC1B,CAAC;AAgBD,MAAM,UAAU,kBAAkB;IAChC,IAAM,KAAK,GACT,GAAG,yNAAA,sJAOF,IAAA,CAAC;IAEJ,IAAM,IAAI,GAAG,wBAAwB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,UAAC,MAAM,EAAE,KAAK,IAAK,OAAA,CAAC;QACtE,UAAU,EAAE,QAAQ;QACpB,MAAM,QAAA;QACN,QAAQ,EAAE,KAAK,GAAG,CAAC;KACpB,CAAC,EAJqE,CAIrE,CAAC,CAAC;IAEJ,IAAM,IAAI,GAAG,IAAI,UAAU,CAAC,UAAC,SAAS;QAC9B,IAAA,KAA4B,SAAS,CAAC,SAAS,EAA7C,cAAU,EAAV,MAAM,mBAAG,CAAC,KAAA,EAAE,aAAS,EAAT,KAAK,mBAAG,CAAC,KAAwB,CAAC;QACtD,IAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC;QAEnD,OAAO,IAAI,UAAU,CAAC,UAAC,QAAQ;YAC7B,UAAU,CAAC;gBACT,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,OAAO,SAAA,EAAE,EAAE,CAAC,CAAC;gBACrC,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACtB,CAAC,EAAE,EAAE,CAAC,CAAC;QACT,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,KAAK,OAAA,EAAE,IAAI,MAAA,EAAE,CAAC;AACzB,CAAC","sourcesContent":["import { ApolloLink, Observable, gql } from \"../../../core/index.js\";\nimport type { TypedDocumentNode } from \"../../../core/index.js\";\nimport type { MockedResponse } from \"../../core/index.js\";\n\nexport interface SimpleCaseData {\n greeting: string;\n}\n\nexport function setupSimpleCase() {\n const query: TypedDocumentNode<SimpleCaseData, Record<string, never>> = gql`\n query GreetingQuery {\n greeting\n }\n `;\n\n const mocks: MockedResponse<SimpleCaseData>[] = [\n {\n request: { query },\n result: { data: { greeting: \"Hello\" } },\n delay: 10,\n },\n ];\n\n return { query, mocks };\n}\n\nexport interface VariablesCaseData {\n character: {\n __typename: \"Character\";\n id: string;\n name: string;\n };\n}\n\nexport interface VariablesCaseVariables {\n id: string;\n}\n\nexport function setupVariablesCase() {\n const query: TypedDocumentNode<VariablesCaseData, VariablesCaseVariables> =\n gql`\n query CharacterQuery($id: ID!) {\n character(id: $id) {\n id\n name\n }\n }\n `;\n const CHARACTERS = [\"Spider-Man\", \"Black Widow\", \"Iron Man\", \"Hulk\"];\n\n const mocks: MockedResponse<VariablesCaseData>[] = [...CHARACTERS].map(\n (name, index) => ({\n request: { query, variables: { id: String(index + 1) } },\n result: {\n data: {\n character: { __typename: \"Character\", id: String(index + 1), name },\n },\n },\n delay: 20,\n })\n );\n\n return { mocks, query };\n}\n\ninterface Letter {\n letter: string;\n position: number;\n}\n\nexport interface PaginatedCaseData {\n letters: Letter[];\n}\n\nexport interface PaginatedCaseVariables {\n limit?: number;\n offset?: number;\n}\n\nexport function setupPaginatedCase() {\n const query: TypedDocumentNode<PaginatedCaseData, PaginatedCaseVariables> =\n gql`\n query letters($limit: Int, $offset: Int) {\n letters(limit: $limit) {\n letter\n position\n }\n }\n `;\n\n const data = \"ABCDEFGHIJKLMNOPQRSTUV\".split(\"\").map((letter, index) => ({\n __typename: \"Letter\",\n letter,\n position: index + 1,\n }));\n\n const link = new ApolloLink((operation) => {\n const { offset = 0, limit = 2 } = operation.variables;\n const letters = data.slice(offset, offset + limit);\n\n return new Observable((observer) => {\n setTimeout(() => {\n observer.next({ data: { letters } });\n observer.complete();\n }, 10);\n });\n });\n\n return { query, link };\n}\n"]}
|
||||
8
graphql-subscription/node_modules/@apollo/client/testing/matchers/ProfiledComponent.d.ts
generated
vendored
Normal file
8
graphql-subscription/node_modules/@apollo/client/testing/matchers/ProfiledComponent.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { MatcherFunction } from "expect";
|
||||
import type { NextRenderOptions } from "../internal/index.js";
|
||||
export declare const toRerender: MatcherFunction<[options?: NextRenderOptions]>;
|
||||
export declare const toRenderExactlyTimes: MatcherFunction<[
|
||||
times: number,
|
||||
options?: NextRenderOptions
|
||||
]>;
|
||||
//# sourceMappingURL=ProfiledComponent.d.ts.map
|
||||
110
graphql-subscription/node_modules/@apollo/client/testing/matchers/ProfiledComponent.js
generated
vendored
Normal file
110
graphql-subscription/node_modules/@apollo/client/testing/matchers/ProfiledComponent.js
generated
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
import { __assign, __awaiter, __generator } from "tslib";
|
||||
import { WaitForRenderTimeoutError } from "../internal/index.js";
|
||||
export var toRerender = function (actual, options) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var _profiler, profiler, hint, pass, e_1;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
_profiler = actual;
|
||||
profiler = "Profiler" in _profiler ? _profiler.Profiler : _profiler;
|
||||
hint = this.utils.matcherHint("toRerender", "ProfiledComponent", "");
|
||||
pass = true;
|
||||
_a.label = 1;
|
||||
case 1:
|
||||
_a.trys.push([1, 3, , 4]);
|
||||
return [4 /*yield*/, profiler.peekRender(__assign({ timeout: 100 }, options))];
|
||||
case 2:
|
||||
_a.sent();
|
||||
return [3 /*break*/, 4];
|
||||
case 3:
|
||||
e_1 = _a.sent();
|
||||
if (e_1 instanceof WaitForRenderTimeoutError) {
|
||||
pass = false;
|
||||
}
|
||||
else {
|
||||
throw e_1;
|
||||
}
|
||||
return [3 /*break*/, 4];
|
||||
case 4: return [2 /*return*/, {
|
||||
pass: pass,
|
||||
message: function () {
|
||||
return (hint +
|
||||
"\n\nExpected component to".concat(pass ? " not" : "", " rerender, ") +
|
||||
"but it did".concat(pass ? "" : " not", "."));
|
||||
},
|
||||
}];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
/** to be thrown to "break" test execution and fail it */
|
||||
var failed = {};
|
||||
export var toRenderExactlyTimes = function (actual, times, optionsPerRender) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var _profiler, profiler, options, hint, pass, e_2, e_3, e_4;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
_profiler = actual;
|
||||
profiler = "Profiler" in _profiler ? _profiler.Profiler : _profiler;
|
||||
options = __assign({ timeout: 100 }, optionsPerRender);
|
||||
hint = this.utils.matcherHint("toRenderExactlyTimes");
|
||||
pass = true;
|
||||
_a.label = 1;
|
||||
case 1:
|
||||
_a.trys.push([1, 11, , 12]);
|
||||
if (profiler.totalRenderCount() > times) {
|
||||
throw failed;
|
||||
}
|
||||
_a.label = 2;
|
||||
case 2:
|
||||
_a.trys.push([2, 6, , 7]);
|
||||
_a.label = 3;
|
||||
case 3:
|
||||
if (!(profiler.totalRenderCount() < times)) return [3 /*break*/, 5];
|
||||
return [4 /*yield*/, profiler.waitForNextRender(options)];
|
||||
case 4:
|
||||
_a.sent();
|
||||
return [3 /*break*/, 3];
|
||||
case 5: return [3 /*break*/, 7];
|
||||
case 6:
|
||||
e_2 = _a.sent();
|
||||
// timeouts here should just fail the test, rethrow other errors
|
||||
throw e_2 instanceof WaitForRenderTimeoutError ? failed : e_2;
|
||||
case 7:
|
||||
_a.trys.push([7, 9, , 10]);
|
||||
return [4 /*yield*/, profiler.waitForNextRender(options)];
|
||||
case 8:
|
||||
_a.sent();
|
||||
return [3 /*break*/, 10];
|
||||
case 9:
|
||||
e_3 = _a.sent();
|
||||
// we are expecting a timeout here, so swallow that error, rethrow others
|
||||
if (!(e_3 instanceof WaitForRenderTimeoutError)) {
|
||||
throw e_3;
|
||||
}
|
||||
return [3 /*break*/, 10];
|
||||
case 10: return [3 /*break*/, 12];
|
||||
case 11:
|
||||
e_4 = _a.sent();
|
||||
if (e_4 === failed) {
|
||||
pass = false;
|
||||
}
|
||||
else {
|
||||
throw e_4;
|
||||
}
|
||||
return [3 /*break*/, 12];
|
||||
case 12: return [2 /*return*/, {
|
||||
pass: pass,
|
||||
message: function () {
|
||||
return (hint +
|
||||
" Expected component to".concat(pass ? " not" : "", " render exactly ").concat(times, ".") +
|
||||
" It rendered ".concat(profiler.totalRenderCount(), " times."));
|
||||
},
|
||||
}];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=ProfiledComponent.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/matchers/ProfiledComponent.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/matchers/ProfiledComponent.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ProfiledComponent.js","sourceRoot":"","sources":["../../../src/testing/matchers/ProfiledComponent.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAQjE,MAAM,CAAC,IAAM,UAAU,GACrB,UAAgB,MAAM,EAAE,OAAO;;;;;;oBACvB,SAAS,GAAG,MAGQ,CAAC;oBACrB,QAAQ,GAAG,UAAU,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;oBACpE,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,YAAY,EAAE,mBAAmB,EAAE,EAAE,CAAC,CAAC;oBACvE,IAAI,GAAG,IAAI,CAAC;;;;oBAEd,qBAAM,QAAQ,CAAC,UAAU,YAAG,OAAO,EAAE,GAAG,IAAK,OAAO,EAAG,EAAA;;oBAAvD,SAAuD,CAAC;;;;oBAExD,IAAI,GAAC,YAAY,yBAAyB,EAAE,CAAC;wBAC3C,IAAI,GAAG,KAAK,CAAC;oBACf,CAAC;yBAAM,CAAC;wBACN,MAAM,GAAC,CAAC;oBACV,CAAC;;wBAGH,sBAAO;wBACL,IAAI,MAAA;wBACJ,OAAO;4BACL,OAAO,CACL,IAAI;gCACJ,mCAA4B,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,gBAAa;gCAC3D,oBAAa,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,MAAG,CACnC,CAAC;wBACJ,CAAC;qBACF,EAAC;;;;CACH,CAAC;AAEJ,yDAAyD;AACzD,IAAM,MAAM,GAAG,EAAE,CAAC;AAElB,MAAM,CAAC,IAAM,oBAAoB,GAE7B,UAAgB,MAAM,EAAE,KAAK,EAAE,gBAAgB;;;;;;oBAC3C,SAAS,GAAG,MAGQ,CAAC;oBACrB,QAAQ,GAAG,UAAU,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;oBACpE,OAAO,cAAK,OAAO,EAAE,GAAG,IAAK,gBAAgB,CAAE,CAAC;oBAChD,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;oBACxD,IAAI,GAAG,IAAI,CAAC;;;;oBAEd,IAAI,QAAQ,CAAC,gBAAgB,EAAE,GAAG,KAAK,EAAE,CAAC;wBACxC,MAAM,MAAM,CAAC;oBACf,CAAC;;;;;;yBAEQ,CAAA,QAAQ,CAAC,gBAAgB,EAAE,GAAG,KAAK,CAAA;oBACxC,qBAAM,QAAQ,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAA;;oBAAzC,SAAyC,CAAC;;;;;oBAG5C,gEAAgE;oBAChE,MAAM,GAAC,YAAY,yBAAyB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAC,CAAC;;;oBAG1D,qBAAM,QAAQ,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAA;;oBAAzC,SAAyC,CAAC;;;;oBAE1C,yEAAyE;oBACzE,IAAI,CAAC,CAAC,GAAC,YAAY,yBAAyB,CAAC,EAAE,CAAC;wBAC9C,MAAM,GAAC,CAAC;oBACV,CAAC;;;;;oBAGH,IAAI,GAAC,KAAK,MAAM,EAAE,CAAC;wBACjB,IAAI,GAAG,KAAK,CAAC;oBACf,CAAC;yBAAM,CAAC;wBACN,MAAM,GAAC,CAAC;oBACV,CAAC;;yBAEH,sBAAO;wBACL,IAAI,MAAA;wBACJ,OAAO;4BACL,OAAO,CACL,IAAI;gCACJ,gCAAyB,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,6BAAmB,KAAK,MAAG;gCACtE,uBAAgB,QAAQ,CAAC,gBAAgB,EAAE,YAAS,CACrD,CAAC;wBACJ,CAAC;qBACF,EAAC;;;;CACH,CAAC","sourcesContent":["import type { MatcherFunction } from \"expect\";\nimport { WaitForRenderTimeoutError } from \"../internal/index.js\";\nimport type {\n NextRenderOptions,\n Profiler,\n ProfiledComponent,\n ProfiledHook,\n} from \"../internal/index.js\";\n\nexport const toRerender: MatcherFunction<[options?: NextRenderOptions]> =\n async function (actual, options) {\n const _profiler = actual as\n | Profiler<any>\n | ProfiledComponent<any, any>\n | ProfiledHook<any, any>;\n const profiler = \"Profiler\" in _profiler ? _profiler.Profiler : _profiler;\n const hint = this.utils.matcherHint(\"toRerender\", \"ProfiledComponent\", \"\");\n let pass = true;\n try {\n await profiler.peekRender({ timeout: 100, ...options });\n } catch (e) {\n if (e instanceof WaitForRenderTimeoutError) {\n pass = false;\n } else {\n throw e;\n }\n }\n\n return {\n pass,\n message() {\n return (\n hint +\n `\\n\\nExpected component to${pass ? \" not\" : \"\"} rerender, ` +\n `but it did${pass ? \"\" : \" not\"}.`\n );\n },\n };\n };\n\n/** to be thrown to \"break\" test execution and fail it */\nconst failed = {};\n\nexport const toRenderExactlyTimes: MatcherFunction<\n [times: number, options?: NextRenderOptions]\n> = async function (actual, times, optionsPerRender) {\n const _profiler = actual as\n | Profiler<any>\n | ProfiledComponent<any, any>\n | ProfiledHook<any, any>;\n const profiler = \"Profiler\" in _profiler ? _profiler.Profiler : _profiler;\n const options = { timeout: 100, ...optionsPerRender };\n const hint = this.utils.matcherHint(\"toRenderExactlyTimes\");\n let pass = true;\n try {\n if (profiler.totalRenderCount() > times) {\n throw failed;\n }\n try {\n while (profiler.totalRenderCount() < times) {\n await profiler.waitForNextRender(options);\n }\n } catch (e) {\n // timeouts here should just fail the test, rethrow other errors\n throw e instanceof WaitForRenderTimeoutError ? failed : e;\n }\n try {\n await profiler.waitForNextRender(options);\n } catch (e) {\n // we are expecting a timeout here, so swallow that error, rethrow others\n if (!(e instanceof WaitForRenderTimeoutError)) {\n throw e;\n }\n }\n } catch (e) {\n if (e === failed) {\n pass = false;\n } else {\n throw e;\n }\n }\n return {\n pass,\n message() {\n return (\n hint +\n ` Expected component to${pass ? \" not\" : \"\"} render exactly ${times}.` +\n ` It rendered ${profiler.totalRenderCount()} times.`\n );\n },\n };\n};\n"]}
|
||||
2
graphql-subscription/node_modules/@apollo/client/testing/matchers/index.d.ts
generated
vendored
Normal file
2
graphql-subscription/node_modules/@apollo/client/testing/matchers/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
15
graphql-subscription/node_modules/@apollo/client/testing/matchers/index.js
generated
vendored
Normal file
15
graphql-subscription/node_modules/@apollo/client/testing/matchers/index.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import { expect } from "@jest/globals";
|
||||
import { toMatchDocument } from "./toMatchDocument.js";
|
||||
import { toHaveSuspenseCacheEntryUsing } from "./toHaveSuspenseCacheEntryUsing.js";
|
||||
import { toRerender, toRenderExactlyTimes } from "./ProfiledComponent.js";
|
||||
import { toBeGarbageCollected } from "./toBeGarbageCollected.js";
|
||||
import { toBeDisposed } from "./toBeDisposed.js";
|
||||
expect.extend({
|
||||
toBeDisposed: toBeDisposed,
|
||||
toHaveSuspenseCacheEntryUsing: toHaveSuspenseCacheEntryUsing,
|
||||
toMatchDocument: toMatchDocument,
|
||||
toRerender: toRerender,
|
||||
toRenderExactlyTimes: toRenderExactlyTimes,
|
||||
toBeGarbageCollected: toBeGarbageCollected,
|
||||
});
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/matchers/index.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/matchers/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testing/matchers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,CAAC,MAAM,CAAC;IACZ,YAAY,cAAA;IACZ,6BAA6B,+BAAA;IAC7B,eAAe,iBAAA;IACf,UAAU,YAAA;IACV,oBAAoB,sBAAA;IACpB,oBAAoB,sBAAA;CACrB,CAAC,CAAC","sourcesContent":["import { expect } from \"@jest/globals\";\nimport { toMatchDocument } from \"./toMatchDocument.js\";\nimport { toHaveSuspenseCacheEntryUsing } from \"./toHaveSuspenseCacheEntryUsing.js\";\nimport { toRerender, toRenderExactlyTimes } from \"./ProfiledComponent.js\";\nimport { toBeGarbageCollected } from \"./toBeGarbageCollected.js\";\nimport { toBeDisposed } from \"./toBeDisposed.js\";\n\nexpect.extend({\n toBeDisposed,\n toHaveSuspenseCacheEntryUsing,\n toMatchDocument,\n toRerender,\n toRenderExactlyTimes,\n toBeGarbageCollected,\n});\n"]}
|
||||
3
graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeDisposed.d.ts
generated
vendored
Normal file
3
graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeDisposed.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { MatcherFunction } from "expect";
|
||||
export declare const toBeDisposed: MatcherFunction<[]>;
|
||||
//# sourceMappingURL=toBeDisposed.d.ts.map
|
||||
26
graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeDisposed.js
generated
vendored
Normal file
26
graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeDisposed.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import { InternalQueryReference, unwrapQueryRef, } from "../../react/internal/index.js";
|
||||
function isQueryRef(queryRef) {
|
||||
try {
|
||||
return unwrapQueryRef(queryRef) instanceof InternalQueryReference;
|
||||
}
|
||||
catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
export var toBeDisposed = function (queryRef) {
|
||||
var _this = this;
|
||||
var hint = this.utils.matcherHint("toBeDisposed", "queryRef", "", {
|
||||
isNot: this.isNot,
|
||||
});
|
||||
if (!isQueryRef(queryRef)) {
|
||||
throw new Error("\n".concat(hint, "\n\nmust be called with a valid QueryReference"));
|
||||
}
|
||||
var pass = unwrapQueryRef(queryRef).disposed;
|
||||
return {
|
||||
pass: pass,
|
||||
message: function () {
|
||||
return "".concat(hint, "\n\nExpected queryRef ").concat(_this.isNot ? "not " : "", "to be disposed, but it was").concat(_this.isNot ? "" : " not", ".");
|
||||
},
|
||||
};
|
||||
};
|
||||
//# sourceMappingURL=toBeDisposed.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeDisposed.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeDisposed.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"toBeDisposed.js","sourceRoot":"","sources":["../../../src/testing/matchers/toBeDisposed.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,sBAAsB,EACtB,cAAc,GACf,MAAM,+BAA+B,CAAC;AAEvC,SAAS,UAAU,CAAC,QAAiB;IACnC,IAAI,CAAC;QACH,OAAO,cAAc,CAAC,QAAe,CAAC,YAAY,sBAAsB,CAAC;IAC3E,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,CAAC,IAAM,YAAY,GAAwB,UAAU,QAAQ;IAAlB,iBAmBhD;IAlBC,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,cAAc,EAAE,UAAU,EAAE,EAAE,EAAE;QAClE,KAAK,EAAE,IAAI,CAAC,KAAK;KAClB,CAAC,CAAC;IAEH,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,YAAK,IAAI,mDAAgD,CAAC,CAAC;IAC7E,CAAC;IAED,IAAM,IAAI,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;IAE/C,OAAO;QACL,IAAI,MAAA;QACJ,OAAO,EAAE;YACP,OAAO,UAAG,IAAI,mCACZ,KAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,uCACG,KAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,MAAG,CAAC;QAC3D,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { MatcherFunction } from \"expect\";\nimport type { QueryReference } from \"../../react/internal/index.js\";\nimport {\n InternalQueryReference,\n unwrapQueryRef,\n} from \"../../react/internal/index.js\";\n\nfunction isQueryRef(queryRef: unknown): queryRef is QueryReference {\n try {\n return unwrapQueryRef(queryRef as any) instanceof InternalQueryReference;\n } catch (e) {\n return false;\n }\n}\n\nexport const toBeDisposed: MatcherFunction<[]> = function (queryRef) {\n const hint = this.utils.matcherHint(\"toBeDisposed\", \"queryRef\", \"\", {\n isNot: this.isNot,\n });\n\n if (!isQueryRef(queryRef)) {\n throw new Error(`\\n${hint}\\n\\nmust be called with a valid QueryReference`);\n }\n\n const pass = unwrapQueryRef(queryRef).disposed;\n\n return {\n pass,\n message: () => {\n return `${hint}\\n\\nExpected queryRef ${\n this.isNot ? \"not \" : \"\"\n }to be disposed, but it was${this.isNot ? \"\" : \" not\"}.`;\n },\n };\n};\n"]}
|
||||
8
graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeGarbageCollected.d.ts
generated
vendored
Normal file
8
graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeGarbageCollected.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { MatcherFunction } from "expect";
|
||||
declare class WeakRef<T extends WeakKey> {
|
||||
constructor(target: T);
|
||||
deref(): T | undefined;
|
||||
}
|
||||
export declare const toBeGarbageCollected: MatcherFunction<[weakRef: WeakRef<any>]>;
|
||||
export {};
|
||||
//# sourceMappingURL=toBeGarbageCollected.d.ts.map
|
||||
48
graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeGarbageCollected.js
generated
vendored
Normal file
48
graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeGarbageCollected.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
import { __awaiter, __generator } from "tslib";
|
||||
export var toBeGarbageCollected = function (actual) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var hint, pass, interval, timeout;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
hint = this.utils.matcherHint("toBeGarbageCollected");
|
||||
if (!(actual instanceof WeakRef)) {
|
||||
throw new Error(hint +
|
||||
"\n\n" +
|
||||
"Expected value to be a WeakRef, but it was a ".concat(typeof actual, "."));
|
||||
}
|
||||
pass = false;
|
||||
return [4 /*yield*/, Promise.race([
|
||||
new Promise(function (resolve) {
|
||||
timeout = setTimeout(resolve, 1000);
|
||||
}),
|
||||
new Promise(function (resolve) {
|
||||
interval = setInterval(function () {
|
||||
global.gc();
|
||||
pass = actual.deref() === undefined;
|
||||
if (pass) {
|
||||
resolve();
|
||||
}
|
||||
}, 1);
|
||||
}),
|
||||
])];
|
||||
case 1:
|
||||
_a.sent();
|
||||
clearInterval(interval);
|
||||
clearTimeout(timeout);
|
||||
return [2 /*return*/, {
|
||||
pass: pass,
|
||||
message: function () {
|
||||
if (pass) {
|
||||
return (hint +
|
||||
"\n\n" +
|
||||
"Expected value to not be cache-collected, but it was.");
|
||||
}
|
||||
return (hint + "\n\n Expected value to be cache-collected, but it was not.");
|
||||
},
|
||||
}];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=toBeGarbageCollected.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeGarbageCollected.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeGarbageCollected.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"toBeGarbageCollected.js","sourceRoot":"","sources":["../../../src/testing/matchers/toBeGarbageCollected.ts"],"names":[],"mappings":";AASA,MAAM,CAAC,IAAM,oBAAoB,GAC/B,UAAgB,MAAM;;;;;;oBACd,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;oBAE5D,IAAI,CAAC,CAAC,MAAM,YAAY,OAAO,CAAC,EAAE,CAAC;wBACjC,MAAM,IAAI,KAAK,CACb,IAAI;4BACF,MAAM;4BACN,uDAAgD,OAAO,MAAM,MAAG,CACnE,CAAC;oBACJ,CAAC;oBAEG,IAAI,GAAG,KAAK,CAAC;oBAGjB,qBAAM,OAAO,CAAC,IAAI,CAAC;4BACjB,IAAI,OAAO,CAAO,UAAC,OAAO;gCACxB,OAAO,GAAG,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;4BACtC,CAAC,CAAC;4BACF,IAAI,OAAO,CAAO,UAAC,OAAO;gCACxB,QAAQ,GAAG,WAAW,CAAC;oCACrB,MAAM,CAAC,EAAG,EAAE,CAAC;oCACb,IAAI,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,SAAS,CAAC;oCACpC,IAAI,IAAI,EAAE,CAAC;wCACT,OAAO,EAAE,CAAC;oCACZ,CAAC;gCACH,CAAC,EAAE,CAAC,CAAC,CAAC;4BACR,CAAC,CAAC;yBACH,CAAC,EAAA;;oBAbF,SAaE,CAAC;oBAEH,aAAa,CAAC,QAAQ,CAAC,CAAC;oBACxB,YAAY,CAAC,OAAO,CAAC,CAAC;oBAEtB,sBAAO;4BACL,IAAI,MAAA;4BACJ,OAAO,EAAE;gCACP,IAAI,IAAI,EAAE,CAAC;oCACT,OAAO,CACL,IAAI;wCACJ,MAAM;wCACN,uDAAuD,CACxD,CAAC;gCACJ,CAAC;gCAED,OAAO,CACL,IAAI,GAAG,4DAA4D,CACpE,CAAC;4BACJ,CAAC;yBACF,EAAC;;;;CACH,CAAC","sourcesContent":["import type { MatcherFunction } from \"expect\";\n\n// this is necessary because this file is picked up by `tsc` (it's not a test),\n// but our main `tsconfig.json` doesn't include `\"ES2021.WeakRef\"` on purpose\ndeclare class WeakRef<T extends WeakKey> {\n constructor(target: T);\n deref(): T | undefined;\n}\n\nexport const toBeGarbageCollected: MatcherFunction<[weakRef: WeakRef<any>]> =\n async function (actual) {\n const hint = this.utils.matcherHint(\"toBeGarbageCollected\");\n\n if (!(actual instanceof WeakRef)) {\n throw new Error(\n hint +\n \"\\n\\n\" +\n `Expected value to be a WeakRef, but it was a ${typeof actual}.`\n );\n }\n\n let pass = false;\n let interval: NodeJS.Timeout | undefined;\n let timeout: NodeJS.Timeout | undefined;\n await Promise.race([\n new Promise<void>((resolve) => {\n timeout = setTimeout(resolve, 1000);\n }),\n new Promise<void>((resolve) => {\n interval = setInterval(() => {\n global.gc!();\n pass = actual.deref() === undefined;\n if (pass) {\n resolve();\n }\n }, 1);\n }),\n ]);\n\n clearInterval(interval);\n clearTimeout(timeout);\n\n return {\n pass,\n message: () => {\n if (pass) {\n return (\n hint +\n \"\\n\\n\" +\n \"Expected value to not be cache-collected, but it was.\"\n );\n }\n\n return (\n hint + \"\\n\\n Expected value to be cache-collected, but it was not.\"\n );\n },\n };\n };\n"]}
|
||||
11
graphql-subscription/node_modules/@apollo/client/testing/matchers/toHaveSuspenseCacheEntryUsing.d.ts
generated
vendored
Normal file
11
graphql-subscription/node_modules/@apollo/client/testing/matchers/toHaveSuspenseCacheEntryUsing.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import type { MatcherFunction } from "expect";
|
||||
import type { DocumentNode } from "graphql";
|
||||
import type { OperationVariables } from "../../core/index.js";
|
||||
export declare const toHaveSuspenseCacheEntryUsing: MatcherFunction<[
|
||||
query: DocumentNode,
|
||||
options: {
|
||||
variables?: OperationVariables;
|
||||
queryKey?: string | number | any[];
|
||||
}
|
||||
]>;
|
||||
//# sourceMappingURL=toHaveSuspenseCacheEntryUsing.d.ts.map
|
||||
24
graphql-subscription/node_modules/@apollo/client/testing/matchers/toHaveSuspenseCacheEntryUsing.js
generated
vendored
Normal file
24
graphql-subscription/node_modules/@apollo/client/testing/matchers/toHaveSuspenseCacheEntryUsing.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import { __spreadArray } from "tslib";
|
||||
import { ApolloClient } from "../../core/index.js";
|
||||
import { canonicalStringify } from "../../cache/index.js";
|
||||
import { getSuspenseCache } from "../../react/internal/index.js";
|
||||
export var toHaveSuspenseCacheEntryUsing = function (client, query, _a) {
|
||||
var _b;
|
||||
var _c = _a === void 0 ? Object.create(null) : _a, variables = _c.variables, _d = _c.queryKey, queryKey = _d === void 0 ? [] : _d;
|
||||
if (!(client instanceof ApolloClient)) {
|
||||
throw new Error("Actual must be an instance of `ApolloClient`");
|
||||
}
|
||||
var suspenseCache = getSuspenseCache(client);
|
||||
var cacheKey = __spreadArray([
|
||||
query,
|
||||
canonicalStringify(variables)
|
||||
], [].concat(queryKey), true);
|
||||
var queryRef = (_b = suspenseCache["queryRefs"].lookupArray(cacheKey)) === null || _b === void 0 ? void 0 : _b.current;
|
||||
return {
|
||||
pass: !!queryRef,
|
||||
message: function () {
|
||||
return "Expected suspense cache ".concat(queryRef ? "not " : "", "to have cache entry using key");
|
||||
},
|
||||
};
|
||||
};
|
||||
//# sourceMappingURL=toHaveSuspenseCacheEntryUsing.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/testing/matchers/toHaveSuspenseCacheEntryUsing.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/testing/matchers/toHaveSuspenseCacheEntryUsing.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"toHaveSuspenseCacheEntryUsing.js","sourceRoot":"","sources":["../../../src/testing/matchers/toHaveSuspenseCacheEntryUsing.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,MAAM,CAAC,IAAM,6BAA6B,GAQtC,UACF,MAAM,EACN,KAAK,EACL,EAAkD;;QAAlD,qBAA+B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAA,EAAhD,SAAS,eAAA,EAAE,gBAAa,EAAb,QAAQ,mBAAG,EAAE,KAAA;IAE1B,IAAI,CAAC,CAAC,MAAM,YAAY,YAAY,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IAED,IAAM,aAAa,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAE/C,IAAM,QAAQ;QACZ,KAAK;QACL,kBAAkB,CAAC,SAAS,CAAC;OACzB,EAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,OAClC,CAAC;IACF,IAAM,QAAQ,GAAG,MAAA,aAAa,CAAC,WAAW,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,0CAAE,OAAO,CAAC;IAE3E,OAAO;QACL,IAAI,EAAE,CAAC,CAAC,QAAQ;QAChB,OAAO,EAAE;YACP,OAAO,kCACL,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,kCACO,CAAC;QAClC,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { MatcherFunction } from \"expect\";\nimport type { DocumentNode } from \"graphql\";\nimport type { OperationVariables } from \"../../core/index.js\";\nimport { ApolloClient } from \"../../core/index.js\";\nimport { canonicalStringify } from \"../../cache/index.js\";\nimport { getSuspenseCache } from \"../../react/internal/index.js\";\nimport type { CacheKey } from \"../../react/internal/index.js\";\n\nexport const toHaveSuspenseCacheEntryUsing: MatcherFunction<\n [\n query: DocumentNode,\n options: {\n variables?: OperationVariables;\n queryKey?: string | number | any[];\n },\n ]\n> = function (\n client,\n query,\n { variables, queryKey = [] } = Object.create(null)\n) {\n if (!(client instanceof ApolloClient)) {\n throw new Error(\"Actual must be an instance of `ApolloClient`\");\n }\n\n const suspenseCache = getSuspenseCache(client);\n\n const cacheKey: CacheKey = [\n query,\n canonicalStringify(variables),\n ...([] as any[]).concat(queryKey),\n ];\n const queryRef = suspenseCache[\"queryRefs\"].lookupArray(cacheKey)?.current;\n\n return {\n pass: !!queryRef,\n message: () => {\n return `Expected suspense cache ${\n queryRef ? \"not \" : \"\"\n }to have cache entry using key`;\n },\n };\n};\n"]}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user