@envelop/testing 5.0.0-alpha-a07c198b.0 → 5.0.0-alpha-20220902173253-1ce5e1b0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/index.js +9 -1
- package/esm/index.js +9 -1
- package/package.json +5 -5
- package/typings/index.d.cts +3 -3
- package/typings/index.d.ts +3 -3
package/cjs/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.collectAsyncIteratorValues = exports.assertStreamExecutionValue = exports.assertSingleExecutionValue = exports.createTestkit = exports.createSpiedPlugin = void 0;
|
|
4
|
-
const graphql_1 = require("
|
|
4
|
+
const graphql_1 = require("graphql");
|
|
5
5
|
const core_1 = require("@envelop/core");
|
|
6
6
|
const utils_1 = require("@graphql-tools/utils");
|
|
7
7
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
@@ -55,12 +55,20 @@ function createTestkit(pluginsOrEnvelop, schema) {
|
|
|
55
55
|
let getEnveloped = Array.isArray(pluginsOrEnvelop)
|
|
56
56
|
? (0, core_1.envelop)({
|
|
57
57
|
plugins: [...(schema ? [(0, core_1.useSchema)((0, utils_1.mapSchema)(schema))] : []), ...pluginsOrEnvelop],
|
|
58
|
+
parse: graphql_1.parse,
|
|
59
|
+
execute: graphql_1.execute,
|
|
60
|
+
validate: graphql_1.validate,
|
|
61
|
+
subscribe: graphql_1.subscribe,
|
|
58
62
|
})
|
|
59
63
|
: pluginsOrEnvelop;
|
|
60
64
|
return {
|
|
61
65
|
modifyPlugins(modifyPluginsFn) {
|
|
62
66
|
getEnveloped = (0, core_1.envelop)({
|
|
63
67
|
plugins: [...(schema ? [(0, core_1.useSchema)((0, utils_1.mapSchema)(schema))] : []), ...modifyPluginsFn(getEnveloped._plugins)],
|
|
68
|
+
parse: graphql_1.parse,
|
|
69
|
+
execute: graphql_1.execute,
|
|
70
|
+
validate: graphql_1.validate,
|
|
71
|
+
subscribe: graphql_1.subscribe,
|
|
64
72
|
});
|
|
65
73
|
},
|
|
66
74
|
mockPhase(phaseReplacement) {
|
package/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getOperationAST, GraphQLError, print, } from '
|
|
1
|
+
import { getOperationAST, GraphQLError, print, execute, parse, subscribe, validate, } from 'graphql';
|
|
2
2
|
import { useSchema, envelop, isAsyncIterable } from '@envelop/core';
|
|
3
3
|
import { mapSchema as cloneSchema, isDocumentNode } from '@graphql-tools/utils';
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
@@ -51,12 +51,20 @@ export function createTestkit(pluginsOrEnvelop, schema) {
|
|
|
51
51
|
let getEnveloped = Array.isArray(pluginsOrEnvelop)
|
|
52
52
|
? envelop({
|
|
53
53
|
plugins: [...(schema ? [useSchema(cloneSchema(schema))] : []), ...pluginsOrEnvelop],
|
|
54
|
+
parse,
|
|
55
|
+
execute,
|
|
56
|
+
validate,
|
|
57
|
+
subscribe,
|
|
54
58
|
})
|
|
55
59
|
: pluginsOrEnvelop;
|
|
56
60
|
return {
|
|
57
61
|
modifyPlugins(modifyPluginsFn) {
|
|
58
62
|
getEnveloped = envelop({
|
|
59
63
|
plugins: [...(schema ? [useSchema(cloneSchema(schema))] : []), ...modifyPluginsFn(getEnveloped._plugins)],
|
|
64
|
+
parse,
|
|
65
|
+
execute,
|
|
66
|
+
validate,
|
|
67
|
+
subscribe,
|
|
60
68
|
});
|
|
61
69
|
},
|
|
62
70
|
mockPhase(phaseReplacement) {
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envelop/testing",
|
|
3
|
-
"version": "5.0.0-alpha-
|
|
3
|
+
"version": "5.0.0-alpha-20220902173253-1ce5e1b0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@envelop/core": "3.0.0-alpha-
|
|
7
|
-
"@envelop/types": "
|
|
6
|
+
"@envelop/core": "3.0.0-alpha-20220902173253-1ce5e1b0",
|
|
7
|
+
"@envelop/types": "2.4.1-alpha-20220902173253-1ce5e1b0",
|
|
8
8
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@graphql-tools/
|
|
12
|
-
"
|
|
11
|
+
"@graphql-tools/utils": "^8.8.0",
|
|
12
|
+
"tslib": "^2.4.0"
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
package/typings/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="jest" />
|
|
2
|
-
import { DocumentNode, ExecutionResult, GraphQLSchema } from '
|
|
3
|
-
import {
|
|
2
|
+
import { DocumentNode, ExecutionResult, GraphQLSchema } from 'graphql';
|
|
3
|
+
import { envelop } from '@envelop/core';
|
|
4
4
|
import { GetEnvelopedFn, Plugin } from '@envelop/types';
|
|
5
5
|
export declare type ModifyPluginsFn = (plugins: Plugin<any>[]) => Plugin<any>[];
|
|
6
6
|
export declare type PhaseReplacementParams = {
|
|
@@ -48,7 +48,7 @@ export declare type TestkitInstance = {
|
|
|
48
48
|
mockPhase: (phaseReplacement: PhaseReplacementParams) => void;
|
|
49
49
|
wait: (ms: number) => Promise<void>;
|
|
50
50
|
};
|
|
51
|
-
export declare function createTestkit(pluginsOrEnvelop: GetEnvelopedFn<any> |
|
|
51
|
+
export declare function createTestkit(pluginsOrEnvelop: GetEnvelopedFn<any> | Parameters<typeof envelop>['0']['plugins'], schema?: GraphQLSchema): TestkitInstance;
|
|
52
52
|
export declare function assertSingleExecutionValue(input: ExecutionReturn): asserts input is ExecutionResult;
|
|
53
53
|
export declare function assertStreamExecutionValue(input: ExecutionReturn): asserts input is AsyncIterableIterator<ExecutionResult>;
|
|
54
54
|
export declare const collectAsyncIteratorValues: <TType>(asyncIterable: AsyncIterableIterator<TType>) => Promise<TType[]>;
|
package/typings/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="jest" />
|
|
2
|
-
import { DocumentNode, ExecutionResult, GraphQLSchema } from '
|
|
3
|
-
import {
|
|
2
|
+
import { DocumentNode, ExecutionResult, GraphQLSchema } from 'graphql';
|
|
3
|
+
import { envelop } from '@envelop/core';
|
|
4
4
|
import { GetEnvelopedFn, Plugin } from '@envelop/types';
|
|
5
5
|
export declare type ModifyPluginsFn = (plugins: Plugin<any>[]) => Plugin<any>[];
|
|
6
6
|
export declare type PhaseReplacementParams = {
|
|
@@ -48,7 +48,7 @@ export declare type TestkitInstance = {
|
|
|
48
48
|
mockPhase: (phaseReplacement: PhaseReplacementParams) => void;
|
|
49
49
|
wait: (ms: number) => Promise<void>;
|
|
50
50
|
};
|
|
51
|
-
export declare function createTestkit(pluginsOrEnvelop: GetEnvelopedFn<any> |
|
|
51
|
+
export declare function createTestkit(pluginsOrEnvelop: GetEnvelopedFn<any> | Parameters<typeof envelop>['0']['plugins'], schema?: GraphQLSchema): TestkitInstance;
|
|
52
52
|
export declare function assertSingleExecutionValue(input: ExecutionReturn): asserts input is ExecutionResult;
|
|
53
53
|
export declare function assertStreamExecutionValue(input: ExecutionReturn): asserts input is AsyncIterableIterator<ExecutionResult>;
|
|
54
54
|
export declare const collectAsyncIteratorValues: <TType>(asyncIterable: AsyncIterableIterator<TType>) => Promise<TType[]>;
|