@khanacademy/wonder-blocks-testing 2.0.0 → 2.0.4
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/CHANGELOG.md +31 -0
- package/package.json +2 -2
- package/src/gql/gql-request-matches-mock.js +2 -2
- package/src/gql/mock-gql-fetch.js +4 -11
- package/src/gql/types.js +5 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-testing
|
|
2
2
|
|
|
3
|
+
## 2.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [5b5f85ac]
|
|
8
|
+
- @khanacademy/wonder-blocks-data@5.0.0
|
|
9
|
+
|
|
10
|
+
## 2.0.3
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [7c9dd09b]
|
|
15
|
+
- Updated dependencies [febc7309]
|
|
16
|
+
- Updated dependencies [bffc345e]
|
|
17
|
+
- @khanacademy/wonder-blocks-data@4.0.0
|
|
18
|
+
|
|
19
|
+
## 2.0.2
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [6973afa2]
|
|
24
|
+
- @khanacademy/wonder-blocks-data@3.2.0
|
|
25
|
+
|
|
26
|
+
## 2.0.1
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- 9931ae6b: Simplify GQL types
|
|
31
|
+
- Updated dependencies [9931ae6b]
|
|
32
|
+
- @khanacademy/wonder-blocks-data@3.1.3
|
|
33
|
+
|
|
3
34
|
## 2.0.0
|
|
4
35
|
|
|
5
36
|
### Major Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-testing",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@babel/runtime": "^7.16.3",
|
|
17
|
-
"@khanacademy/wonder-blocks-data": "^
|
|
17
|
+
"@khanacademy/wonder-blocks-data": "^5.0.0"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@khanacademy/wonder-stuff-core": "^0.1.2",
|
|
@@ -36,8 +36,8 @@ const areObjectsEqual = (a: any, b: any): boolean => {
|
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
export const gqlRequestMatchesMock = (
|
|
39
|
-
mock: GqlMockOperation<any, any, any
|
|
40
|
-
operation: GqlOperation<any, any
|
|
39
|
+
mock: GqlMockOperation<any, any, any>,
|
|
40
|
+
operation: GqlOperation<any, any>,
|
|
41
41
|
variables: ?{...},
|
|
42
42
|
context: GqlContext,
|
|
43
43
|
): boolean => {
|
|
@@ -52,13 +52,8 @@ export const mockGqlFetch = (): GqlFetchMockFn => {
|
|
|
52
52
|
);
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
const addMockedOperation = <
|
|
56
|
-
|
|
57
|
-
TData,
|
|
58
|
-
TVariables: {...},
|
|
59
|
-
TContext: GqlContext,
|
|
60
|
-
>(
|
|
61
|
-
operation: GqlMockOperation<TType, TData, TVariables, TContext>,
|
|
55
|
+
const addMockedOperation = <TData, TVariables: {...}, TContext: GqlContext>(
|
|
56
|
+
operation: GqlMockOperation<TData, TVariables, TContext>,
|
|
62
57
|
response: GqlMockResponse<TData>,
|
|
63
58
|
onceOnly: boolean,
|
|
64
59
|
): GqlFetchMockFn => {
|
|
@@ -73,22 +68,20 @@ export const mockGqlFetch = (): GqlFetchMockFn => {
|
|
|
73
68
|
};
|
|
74
69
|
|
|
75
70
|
gqlFetchMock.mockOperation = <
|
|
76
|
-
TType,
|
|
77
71
|
TData,
|
|
78
72
|
TVariables: {...},
|
|
79
73
|
TContext: GqlContext,
|
|
80
74
|
>(
|
|
81
|
-
operation: GqlMockOperation<
|
|
75
|
+
operation: GqlMockOperation<TData, TVariables, TContext>,
|
|
82
76
|
response: GqlMockResponse<TData>,
|
|
83
77
|
): GqlFetchMockFn => addMockedOperation(operation, response, false);
|
|
84
78
|
|
|
85
79
|
gqlFetchMock.mockOperationOnce = <
|
|
86
|
-
TType,
|
|
87
80
|
TData,
|
|
88
81
|
TVariables: {...},
|
|
89
82
|
TContext: GqlContext,
|
|
90
83
|
>(
|
|
91
|
-
operation: GqlMockOperation<
|
|
84
|
+
operation: GqlMockOperation<TData, TVariables, TContext>,
|
|
92
85
|
response: GqlMockResponse<TData>,
|
|
93
86
|
): GqlFetchMockFn => addMockedOperation(operation, response, true);
|
|
94
87
|
|
package/src/gql/types.js
CHANGED
|
@@ -3,29 +3,23 @@ import type {GqlOperation, GqlContext} from "@khanacademy/wonder-blocks-data";
|
|
|
3
3
|
import type {GqlMockResponse} from "./make-gql-mock-response.js";
|
|
4
4
|
|
|
5
5
|
export type GqlMockOperation<
|
|
6
|
-
TType,
|
|
7
6
|
TData,
|
|
8
7
|
TVariables: {...},
|
|
9
8
|
TContext: GqlContext,
|
|
10
9
|
> = {|
|
|
11
|
-
operation: GqlOperation<
|
|
10
|
+
operation: GqlOperation<TData, TVariables>,
|
|
12
11
|
variables?: TVariables,
|
|
13
12
|
context?: TContext,
|
|
14
13
|
|};
|
|
15
14
|
|
|
16
|
-
type GqlMockOperationFn = <
|
|
17
|
-
|
|
18
|
-
TData,
|
|
19
|
-
TVariables: {...},
|
|
20
|
-
TContext: GqlContext,
|
|
21
|
-
>(
|
|
22
|
-
operation: GqlMockOperation<TType, TData, TVariables, TContext>,
|
|
15
|
+
type GqlMockOperationFn = <TData, TVariables: {...}, TContext: GqlContext>(
|
|
16
|
+
operation: GqlMockOperation<TData, TVariables, TContext>,
|
|
23
17
|
response: GqlMockResponse<TData>,
|
|
24
18
|
) => GqlFetchMockFn;
|
|
25
19
|
|
|
26
20
|
export type GqlFetchMockFn = {|
|
|
27
21
|
(
|
|
28
|
-
operation: GqlOperation<any, any
|
|
22
|
+
operation: GqlOperation<any, any>,
|
|
29
23
|
variables: ?{...},
|
|
30
24
|
context: GqlContext,
|
|
31
25
|
): Promise<Response>,
|
|
@@ -34,7 +28,7 @@ export type GqlFetchMockFn = {|
|
|
|
34
28
|
|};
|
|
35
29
|
|
|
36
30
|
export type GqlMock = {|
|
|
37
|
-
operation: GqlMockOperation<any, any, any
|
|
31
|
+
operation: GqlMockOperation<any, any, any>,
|
|
38
32
|
onceOnly: boolean,
|
|
39
33
|
used: boolean,
|
|
40
34
|
response: () => Promise<Response>,
|