UNPKG

@zendesk/laika

Version:

Test, mock, intercept and modify Apollo Client's operations — in both browser and unit tests!

14 lines 896 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.hasQueryOperation = exports.hasMutationOperation = exports.hasSubscriptionOperation = void 0; const checkOperationType = (definitions, type) => definitions.some((element) => element.kind === 'OperationDefinition' && element.operation === type); const hasSubscriptionOperation = ( /** @type {Operation} */ { query }) => checkOperationType(query.definitions, 'subscription'); exports.hasSubscriptionOperation = hasSubscriptionOperation; const hasMutationOperation = ( /** @type {Operation} */ { query }) => checkOperationType(query.definitions, 'mutation'); exports.hasMutationOperation = hasMutationOperation; const hasQueryOperation = ( /** @type {Operation} */ { query }) => checkOperationType(query.definitions, 'query'); exports.hasQueryOperation = hasQueryOperation; //# sourceMappingURL=hasOperation.js.map