@khanacademy/wonder-blocks-data 10.0.5 → 10.1.1
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 +38 -0
- package/dist/components/data.d.ts +52 -0
- package/dist/components/data.js.flow +63 -0
- package/dist/components/gql-router.d.ts +24 -0
- package/dist/components/gql-router.js.flow +33 -0
- package/dist/components/intercept-context.d.ts +10 -0
- package/dist/components/intercept-context.js.flow +19 -0
- package/dist/components/intercept-requests.d.ts +42 -0
- package/dist/components/intercept-requests.js.flow +51 -0
- package/dist/components/track-data.d.ts +11 -0
- package/dist/components/track-data.js.flow +18 -0
- package/dist/es/index.js +196 -214
- package/dist/hooks/use-cached-effect.d.ts +70 -0
- package/dist/hooks/use-cached-effect.js.flow +85 -0
- package/dist/hooks/use-gql-router-context.d.ts +5 -0
- package/dist/hooks/use-gql-router-context.js.flow +15 -0
- package/dist/hooks/use-gql.d.ts +12 -0
- package/dist/hooks/use-gql.js.flow +29 -0
- package/dist/hooks/use-hydratable-effect.d.ts +102 -0
- package/dist/hooks/use-hydratable-effect.js.flow +125 -0
- package/dist/hooks/use-request-interception.d.ts +14 -0
- package/dist/hooks/use-request-interception.js.flow +25 -0
- package/dist/hooks/use-server-effect.d.ts +39 -0
- package/dist/hooks/use-server-effect.js.flow +51 -0
- package/dist/hooks/use-shared-cache.d.ts +32 -0
- package/dist/hooks/use-shared-cache.js.flow +43 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +198 -219
- package/dist/index.js.flow +48 -2
- package/dist/util/data-error.d.ts +45 -0
- package/dist/util/data-error.js.flow +64 -0
- package/dist/util/get-gql-data-from-response.d.ts +4 -0
- package/dist/util/get-gql-data-from-response.js.flow +13 -0
- package/dist/util/get-gql-request-id.d.ts +5 -0
- package/dist/util/get-gql-request-id.js.flow +20 -0
- package/dist/util/gql-error.d.ts +28 -0
- package/dist/util/gql-error.js.flow +43 -0
- package/dist/util/gql-router-context.d.ts +3 -0
- package/dist/util/gql-router-context.js.flow +10 -0
- package/dist/util/gql-types.d.ts +34 -0
- package/dist/util/gql-types.js.flow +53 -0
- package/dist/util/graphql-document-node-parser.d.ts +18 -0
- package/dist/util/graphql-document-node-parser.js.flow +31 -0
- package/dist/util/graphql-types.d.ts +19 -0
- package/dist/util/graphql-types.js.flow +30 -0
- package/dist/util/hydration-cache-api.d.ts +17 -0
- package/dist/util/hydration-cache-api.js.flow +30 -0
- package/dist/util/merge-gql-context.d.ts +8 -0
- package/dist/util/merge-gql-context.js.flow +19 -0
- package/dist/util/purge-caches.d.ts +8 -0
- package/dist/util/purge-caches.js.flow +15 -0
- package/dist/util/request-api.d.ts +28 -0
- package/dist/util/request-api.js.flow +34 -0
- package/dist/util/request-fulfillment.d.ts +37 -0
- package/dist/util/request-fulfillment.js.flow +50 -0
- package/dist/util/request-tracking.d.ts +62 -0
- package/dist/util/request-tracking.js.flow +81 -0
- package/dist/util/result-from-cache-response.d.ts +5 -0
- package/dist/util/result-from-cache-response.js.flow +15 -0
- package/dist/util/scoped-in-memory-cache.d.ts +38 -0
- package/dist/util/scoped-in-memory-cache.js.flow +57 -0
- package/dist/util/serializable-in-memory-cache.d.ts +16 -0
- package/dist/util/serializable-in-memory-cache.js.flow +26 -0
- package/dist/util/ssr-cache.d.ts +51 -0
- package/dist/util/ssr-cache.js.flow +87 -0
- package/dist/util/status.d.ts +10 -0
- package/dist/util/status.js.flow +19 -0
- package/dist/util/to-gql-operation.d.ts +32 -0
- package/dist/util/to-gql-operation.js.flow +45 -0
- package/dist/util/types.d.ts +111 -0
- package/dist/util/types.js.flow +151 -0
- package/package.json +5 -6
- package/src/components/__tests__/{data.test.js → data.test.tsx} +50 -16
- package/src/components/__tests__/{gql-router.test.js → gql-router.test.tsx} +6 -7
- package/src/components/__tests__/{intercept-requests.test.js → intercept-requests.test.tsx} +4 -5
- package/src/components/__tests__/{track-data.test.js → track-data.test.tsx} +4 -5
- package/src/components/{data.js → data.ts} +13 -21
- package/src/components/{gql-router.js → gql-router.tsx} +14 -16
- package/src/components/{intercept-context.js → intercept-context.ts} +5 -4
- package/src/components/{intercept-requests.js → intercept-requests.tsx} +9 -10
- package/src/components/{track-data.js → track-data.tsx} +5 -6
- package/src/hooks/__tests__/{use-cached-effect.test.js → use-cached-effect.test.tsx} +65 -63
- package/src/hooks/__tests__/{use-gql-router-context.test.js → use-gql-router-context.test.tsx} +9 -9
- package/src/hooks/__tests__/{use-gql.test.js → use-gql.test.tsx} +23 -24
- package/src/hooks/__tests__/{use-hydratable-effect.test.js → use-hydratable-effect.test.ts} +52 -54
- package/src/hooks/__tests__/{use-request-interception.test.js → use-request-interception.test.tsx} +7 -5
- package/src/hooks/__tests__/{use-server-effect.test.js → use-server-effect.test.ts} +16 -10
- package/src/hooks/__tests__/{use-shared-cache.test.js → use-shared-cache.test.ts} +13 -13
- package/src/hooks/{use-cached-effect.js → use-cached-effect.ts} +34 -31
- package/src/hooks/{use-gql-router-context.js → use-gql-router-context.ts} +6 -7
- package/src/hooks/{use-gql.js → use-gql.ts} +9 -9
- package/src/hooks/{use-hydratable-effect.js → use-hydratable-effect.ts} +60 -67
- package/src/hooks/{use-request-interception.js → use-request-interception.ts} +6 -6
- package/src/hooks/{use-server-effect.js → use-server-effect.ts} +12 -14
- package/src/hooks/{use-shared-cache.js → use-shared-cache.ts} +16 -11
- package/src/index.ts +46 -0
- package/src/util/__tests__/{get-gql-data-from-response.test.js → get-gql-data-from-response.test.ts} +1 -2
- package/src/util/__tests__/{get-gql-request-id.test.js → get-gql-request-id.test.ts} +10 -12
- package/src/util/__tests__/{graphql-document-node-parser.test.js → graphql-document-node-parser.test.ts} +12 -13
- package/src/util/__tests__/{hydration-cache-api.test.js → hydration-cache-api.test.ts} +3 -4
- package/src/util/__tests__/{merge-gql-context.test.js → merge-gql-context.test.ts} +5 -6
- package/src/util/__tests__/{purge-caches.test.js → purge-caches.test.ts} +3 -4
- package/src/util/__tests__/{request-api.test.js → request-api.test.ts} +5 -5
- package/src/util/__tests__/{request-fulfillment.test.js → request-fulfillment.test.ts} +2 -3
- package/src/util/__tests__/{request-tracking.test.js → request-tracking.test.tsx} +15 -8
- package/src/util/__tests__/{result-from-cache-response.test.js → result-from-cache-response.test.ts} +3 -5
- package/src/util/__tests__/{scoped-in-memory-cache.test.js → scoped-in-memory-cache.test.ts} +5 -6
- package/src/util/__tests__/{serializable-in-memory-cache.test.js → serializable-in-memory-cache.test.ts} +8 -8
- package/src/util/__tests__/{ssr-cache.test.js → ssr-cache.test.ts} +5 -4
- package/src/util/__tests__/{to-gql-operation.test.js → to-gql-operation.test.ts} +5 -4
- package/src/util/{data-error.js → data-error.ts} +3 -4
- package/src/util/{get-gql-data-from-response.js → get-gql-data-from-response.ts} +3 -8
- package/src/util/{get-gql-request-id.js → get-gql-request-id.ts} +13 -17
- package/src/util/{gql-error.js → gql-error.ts} +3 -4
- package/src/util/gql-router-context.ts +6 -0
- package/src/util/{gql-types.js → gql-types.ts} +27 -23
- package/src/util/{graphql-document-node-parser.js → graphql-document-node-parser.ts} +8 -9
- package/src/util/graphql-types.ts +27 -0
- package/src/util/{hydration-cache-api.js → hydration-cache-api.ts} +6 -4
- package/src/util/{merge-gql-context.js → merge-gql-context.ts} +3 -3
- package/src/util/{purge-caches.js → purge-caches.ts} +2 -3
- package/src/util/{request-api.js → request-api.ts} +4 -5
- package/src/util/{request-fulfillment.js → request-fulfillment.ts} +15 -14
- package/src/util/{request-tracking.js → request-tracking.ts} +15 -16
- package/src/util/{result-from-cache-response.js → result-from-cache-response.ts} +6 -7
- package/src/util/{scoped-in-memory-cache.js → scoped-in-memory-cache.ts} +3 -4
- package/src/util/{serializable-in-memory-cache.js → serializable-in-memory-cache.ts} +5 -6
- package/src/util/{ssr-cache.js → ssr-cache.ts} +21 -20
- package/src/util/{status.js → status.ts} +5 -6
- package/src/util/{to-gql-operation.js → to-gql-operation.ts} +4 -5
- package/src/util/{types.js → types.ts} +41 -49
- package/tsconfig.json +11 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/src/__docs__/_overview_.stories.mdx +0 -18
- package/src/__docs__/_overview_graphql.stories.mdx +0 -35
- package/src/__docs__/_overview_ssr_.stories.mdx +0 -185
- package/src/__docs__/_overview_testing_.stories.mdx +0 -123
- package/src/__docs__/exports.abort-inflight-requests.stories.mdx +0 -20
- package/src/__docs__/exports.data-error.stories.mdx +0 -23
- package/src/__docs__/exports.data-errors.stories.mdx +0 -23
- package/src/__docs__/exports.data.stories.mdx +0 -146
- package/src/__docs__/exports.fetch-tracked-requests.stories.mdx +0 -24
- package/src/__docs__/exports.get-gql-request-id.stories.mdx +0 -24
- package/src/__docs__/exports.gql-error.stories.mdx +0 -23
- package/src/__docs__/exports.gql-errors.stories.mdx +0 -20
- package/src/__docs__/exports.gql-router.stories.mdx +0 -29
- package/src/__docs__/exports.has-tracked-requests-to-be-fetched.stories.mdx +0 -20
- package/src/__docs__/exports.intercept-requests.stories.mdx +0 -69
- package/src/__docs__/exports.intialize-hydration-cache.stories.mdx +0 -29
- package/src/__docs__/exports.purge-caches.stories.mdx +0 -23
- package/src/__docs__/exports.purge-hydration-cache.stories.mdx +0 -24
- package/src/__docs__/exports.scoped-in-memory-cache.stories.mdx +0 -92
- package/src/__docs__/exports.serializable-in-memory-cache.stories.mdx +0 -112
- package/src/__docs__/exports.shared-cache.stories.mdx +0 -16
- package/src/__docs__/exports.status.stories.mdx +0 -31
- package/src/__docs__/exports.track-data.stories.mdx +0 -209
- package/src/__docs__/exports.use-cached-effect.stories.mdx +0 -44
- package/src/__docs__/exports.use-gql.stories.mdx +0 -41
- package/src/__docs__/exports.use-hydratable-effect.stories.mdx +0 -43
- package/src/__docs__/exports.use-server-effect.stories.mdx +0 -50
- package/src/__docs__/exports.use-shared-cache.stories.mdx +0 -30
- package/src/__docs__/exports.when-client-side.stories.mdx +0 -33
- package/src/__docs__/types.cached-response.stories.mdx +0 -29
- package/src/__docs__/types.error-options.stories.mdx +0 -21
- package/src/__docs__/types.fetch-policy.stories.mdx +0 -44
- package/src/__docs__/types.gql-context.stories.mdx +0 -20
- package/src/__docs__/types.gql-fetch-fn.stories.mdx +0 -24
- package/src/__docs__/types.gql-fetch-options.stories.mdx +0 -24
- package/src/__docs__/types.gql-operation-type.stories.mdx +0 -24
- package/src/__docs__/types.gql-operation.stories.mdx +0 -67
- package/src/__docs__/types.raw-scoped-cache.stories.mdx +0 -27
- package/src/__docs__/types.response-cache.stories.mdx +0 -33
- package/src/__docs__/types.result.stories.mdx +0 -39
- package/src/__docs__/types.scoped-cache.stories.mdx +0 -114
- package/src/__docs__/types.valid-cache-data.stories.mdx +0 -23
- package/src/index.js +0 -55
- package/src/util/gql-router-context.js +0 -6
- package/src/util/graphql-types.js +0 -30
- /package/src/hooks/__tests__/__snapshots__/{use-shared-cache.test.js.snap → use-shared-cache.test.ts.snap} +0 -0
- /package/src/util/__tests__/__snapshots__/{scoped-in-memory-cache.test.js.snap → scoped-in-memory-cache.test.ts.snap} +0 -0
- /package/src/util/__tests__/__snapshots__/{serializable-in-memory-cache.test.js.snap → serializable-in-memory-cache.test.ts.snap} +0 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import {
|
|
4
3
|
renderHook as clientRenderHook,
|
|
@@ -6,28 +5,25 @@ import {
|
|
|
6
5
|
} from "@testing-library/react-hooks";
|
|
7
6
|
import {renderHook as serverRenderHook} from "@testing-library/react-hooks/server";
|
|
8
7
|
import {render, act as reactAct} from "@testing-library/react";
|
|
8
|
+
import {values} from "@khanacademy/wonder-stuff-core";
|
|
9
9
|
|
|
10
10
|
import {Server} from "@khanacademy/wonder-blocks-core";
|
|
11
|
-
import {Status} from "../../util/status
|
|
11
|
+
import {Status} from "../../util/status";
|
|
12
12
|
|
|
13
|
-
import {RequestFulfillment} from "../../util/request-fulfillment
|
|
14
|
-
import * as UseRequestInterception from "../use-request-interception
|
|
15
|
-
import * as UseSharedCache from "../use-shared-cache
|
|
13
|
+
import {RequestFulfillment} from "../../util/request-fulfillment";
|
|
14
|
+
import * as UseRequestInterception from "../use-request-interception";
|
|
15
|
+
import * as UseSharedCache from "../use-shared-cache";
|
|
16
16
|
|
|
17
|
-
import {useCachedEffect} from "../use-cached-effect
|
|
17
|
+
import {useCachedEffect} from "../use-cached-effect";
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
// have fixed:
|
|
21
|
-
// https://github.com/import-js/eslint-plugin-import/issues/2073
|
|
22
|
-
// eslint-disable-next-line import/named
|
|
23
|
-
import {FetchPolicy} from "../../util/types.js";
|
|
19
|
+
import {FetchPolicy} from "../../util/types";
|
|
24
20
|
|
|
25
|
-
jest.mock("../use-request-interception
|
|
26
|
-
jest.mock("../use-shared-cache
|
|
21
|
+
jest.mock("../use-request-interception");
|
|
22
|
+
jest.mock("../use-shared-cache");
|
|
27
23
|
|
|
28
|
-
const allPolicies = Array.from(FetchPolicy
|
|
29
|
-
const allPoliciesBut = (policy: FetchPolicy) =>
|
|
30
|
-
allPolicies.filter((p) => p !== policy);
|
|
24
|
+
const allPolicies = Array.from(values(FetchPolicy));
|
|
25
|
+
const allPoliciesBut = (policy: typeof FetchPolicy[keyof typeof FetchPolicy]) =>
|
|
26
|
+
allPolicies.filter((p: any) => p !== policy);
|
|
31
27
|
|
|
32
28
|
describe("#useCachedEffect", () => {
|
|
33
29
|
beforeEach(() => {
|
|
@@ -41,14 +37,14 @@ describe("#useCachedEffect", () => {
|
|
|
41
37
|
jest.spyOn(
|
|
42
38
|
UseRequestInterception,
|
|
43
39
|
"useRequestInterception",
|
|
44
|
-
).mockImplementation((_, handler) => handler);
|
|
40
|
+
).mockImplementation((_: any, handler: any) => handler);
|
|
45
41
|
|
|
46
42
|
// We need the cache to work a little so that we get our result.
|
|
47
|
-
const cache = {};
|
|
43
|
+
const cache: Record<string, any> = {};
|
|
48
44
|
jest.spyOn(UseSharedCache, "useSharedCache").mockImplementation(
|
|
49
|
-
(id, _, defaultValue) => {
|
|
45
|
+
(id: any, _: any, defaultValue: any) => {
|
|
50
46
|
const setCache = React.useCallback(
|
|
51
|
-
(v) => (cache[id] = v),
|
|
47
|
+
(v: any) => (cache[id] = v),
|
|
52
48
|
[id],
|
|
53
49
|
);
|
|
54
50
|
return [cache[id] ?? defaultValue, setCache];
|
|
@@ -84,7 +80,7 @@ describe("#useCachedEffect", () => {
|
|
|
84
80
|
${"foo"} | ${"foo"}
|
|
85
81
|
`(
|
|
86
82
|
"should call useSharedCache with id, scope=$scope, without a default",
|
|
87
|
-
({scope, cachedResult, expectedScope}) => {
|
|
83
|
+
({scope, cachedResult, expectedScope}: any) => {
|
|
88
84
|
const fakeHandler = jest.fn();
|
|
89
85
|
const useSharedCacheSpy = jest.spyOn(
|
|
90
86
|
UseSharedCache,
|
|
@@ -106,7 +102,7 @@ describe("#useCachedEffect", () => {
|
|
|
106
102
|
|
|
107
103
|
it.each(allPolicies)(
|
|
108
104
|
"should not request data for FetchPolicy.%s",
|
|
109
|
-
(fetchPolicy) => {
|
|
105
|
+
(fetchPolicy: any) => {
|
|
110
106
|
// Arrange
|
|
111
107
|
const fakeHandler = jest.fn().mockResolvedValue("data");
|
|
112
108
|
|
|
@@ -122,7 +118,7 @@ describe("#useCachedEffect", () => {
|
|
|
122
118
|
|
|
123
119
|
describe.each(allPolicies)(
|
|
124
120
|
"with FetchPolicy.%s without cached result",
|
|
125
|
-
(fetchPolicy) => {
|
|
121
|
+
(fetchPolicy: any) => {
|
|
126
122
|
it("should return a loading result", () => {
|
|
127
123
|
// Arrange
|
|
128
124
|
const fakeHandler = jest.fn();
|
|
@@ -144,7 +140,7 @@ describe("#useCachedEffect", () => {
|
|
|
144
140
|
|
|
145
141
|
describe.each(allPoliciesBut(FetchPolicy.NetworkOnly))(
|
|
146
142
|
"with FetchPolicy.%s with cached result",
|
|
147
|
-
(fetchPolicy) => {
|
|
143
|
+
(fetchPolicy: any) => {
|
|
148
144
|
it("should return the result", () => {
|
|
149
145
|
// Arrange
|
|
150
146
|
const fakeHandler = jest.fn();
|
|
@@ -219,7 +215,7 @@ describe("#useCachedEffect", () => {
|
|
|
219
215
|
|
|
220
216
|
it("should share inflight requests for the same requestId", () => {
|
|
221
217
|
// Arrange
|
|
222
|
-
const pending = new Promise((resolve, reject) => {
|
|
218
|
+
const pending = new Promise((resolve: any, reject: any) => {
|
|
223
219
|
/*pending*/
|
|
224
220
|
});
|
|
225
221
|
const fakeHandler = jest.fn().mockReturnValue(pending);
|
|
@@ -234,7 +230,7 @@ describe("#useCachedEffect", () => {
|
|
|
234
230
|
|
|
235
231
|
it.each(allPoliciesBut(FetchPolicy.CacheOnly))(
|
|
236
232
|
"should provide function that causes refetch with FetchPolicy.%s",
|
|
237
|
-
async (fetchPolicy) => {
|
|
233
|
+
async (fetchPolicy: any) => {
|
|
238
234
|
// Arrange
|
|
239
235
|
const response = Promise.resolve("DATA1");
|
|
240
236
|
const fakeHandler = jest.fn().mockReturnValue(response);
|
|
@@ -248,9 +244,11 @@ describe("#useCachedEffect", () => {
|
|
|
248
244
|
useCachedEffect("ID", fakeHandler, {fetchPolicy}),
|
|
249
245
|
);
|
|
250
246
|
fakeHandler.mockClear();
|
|
251
|
-
|
|
247
|
+
// @ts-expect-error [FEI-5019] - TS2769 - No overload matches this call.
|
|
248
|
+
await act((): Promise<unknown> => response);
|
|
252
249
|
act(refetch);
|
|
253
|
-
|
|
250
|
+
// @ts-expect-error [FEI-5019] - TS2769 - No overload matches this call.
|
|
251
|
+
await act((): Promise<unknown> => response);
|
|
254
252
|
|
|
255
253
|
// Assert
|
|
256
254
|
expect(fakeHandler).toHaveBeenCalledTimes(1);
|
|
@@ -281,7 +279,7 @@ describe("#useCachedEffect", () => {
|
|
|
281
279
|
|
|
282
280
|
it.each(allPoliciesBut(FetchPolicy.CacheOnly))(
|
|
283
281
|
"should fulfill request when there is no cached value and FetchPolicy.%s",
|
|
284
|
-
(fetchPolicy) => {
|
|
282
|
+
(fetchPolicy: any) => {
|
|
285
283
|
// Arrange
|
|
286
284
|
const fakeHandler = jest.fn();
|
|
287
285
|
jest.spyOn(UseSharedCache, "useSharedCache").mockReturnValue([
|
|
@@ -301,7 +299,7 @@ describe("#useCachedEffect", () => {
|
|
|
301
299
|
|
|
302
300
|
it.each([FetchPolicy.CacheAndNetwork, FetchPolicy.NetworkOnly])(
|
|
303
301
|
"should fulfill request when there is a cached value and FetchPolicy.%s",
|
|
304
|
-
(fetchPolicy) => {
|
|
302
|
+
(fetchPolicy: any) => {
|
|
305
303
|
// Arrange
|
|
306
304
|
const fakeHandler = jest.fn();
|
|
307
305
|
jest.spyOn(UseSharedCache, "useSharedCache").mockReturnValue([
|
|
@@ -328,7 +326,7 @@ describe("#useCachedEffect", () => {
|
|
|
328
326
|
${Status.aborted()}
|
|
329
327
|
`(
|
|
330
328
|
"should not fulfill request when there is a cached response of $cachedResult and FetchPolicy.CacheBeforeNetwork",
|
|
331
|
-
({cachedResult}) => {
|
|
329
|
+
({cachedResult}: any) => {
|
|
332
330
|
const fakeHandler = jest.fn();
|
|
333
331
|
jest.spyOn(UseSharedCache, "useSharedCache").mockReturnValue([
|
|
334
332
|
cachedResult,
|
|
@@ -355,7 +353,7 @@ describe("#useCachedEffect", () => {
|
|
|
355
353
|
${Status.aborted()}
|
|
356
354
|
`(
|
|
357
355
|
"should not fulfill request when there is a cached response of $cachedResult and FetchPolicy.CacheOnly",
|
|
358
|
-
({cachedResult}) => {
|
|
356
|
+
({cachedResult}: any) => {
|
|
359
357
|
const fakeHandler = jest.fn();
|
|
360
358
|
jest.spyOn(UseSharedCache, "useSharedCache").mockReturnValue([
|
|
361
359
|
cachedResult,
|
|
@@ -395,7 +393,7 @@ describe("#useCachedEffect", () => {
|
|
|
395
393
|
|
|
396
394
|
// Act
|
|
397
395
|
const {rerender, waitForNextUpdate} = clientRenderHook(
|
|
398
|
-
({requestId}) => useCachedEffect(requestId, fakeHandler),
|
|
396
|
+
({requestId}: any) => useCachedEffect(requestId, fakeHandler),
|
|
399
397
|
{
|
|
400
398
|
initialProps: {requestId: "ID"},
|
|
401
399
|
},
|
|
@@ -437,15 +435,13 @@ describe("#useCachedEffect", () => {
|
|
|
437
435
|
|
|
438
436
|
// Act
|
|
439
437
|
const {rerender, result} = clientRenderHook(
|
|
440
|
-
({requestId}) => useCachedEffect(requestId, fakeHandler),
|
|
438
|
+
({requestId}: any) => useCachedEffect(requestId, fakeHandler),
|
|
441
439
|
{
|
|
442
440
|
initialProps: {requestId: "ID"},
|
|
443
441
|
},
|
|
444
442
|
);
|
|
445
443
|
rerender({requestId: "ID2"});
|
|
446
|
-
await act((): Promise<
|
|
447
|
-
Promise.all([response1, response2]),
|
|
448
|
-
);
|
|
444
|
+
await act((): Promise<any> => Promise.all([response1, response2]));
|
|
449
445
|
|
|
450
446
|
// Assert
|
|
451
447
|
expect(result.all).not.toContainEqual(Status.success("DATA1"));
|
|
@@ -462,15 +458,13 @@ describe("#useCachedEffect", () => {
|
|
|
462
458
|
|
|
463
459
|
// Act
|
|
464
460
|
const {rerender, result} = clientRenderHook(
|
|
465
|
-
({requestId}) => useCachedEffect(requestId, fakeHandler),
|
|
461
|
+
({requestId}: any) => useCachedEffect(requestId, fakeHandler),
|
|
466
462
|
{
|
|
467
463
|
initialProps: {requestId: "ID"},
|
|
468
464
|
},
|
|
469
465
|
);
|
|
470
466
|
rerender({requestId: "ID2"});
|
|
471
|
-
await act((): Promise<
|
|
472
|
-
Promise.all([response1, response2]),
|
|
473
|
-
);
|
|
467
|
+
await act((): Promise<any> => Promise.all([response1, response2]));
|
|
474
468
|
|
|
475
469
|
// Assert
|
|
476
470
|
expect(result.current[0]).toStrictEqual(Status.success("DATA2"));
|
|
@@ -496,13 +490,14 @@ describe("#useCachedEffect", () => {
|
|
|
496
490
|
|
|
497
491
|
// Act
|
|
498
492
|
const {rerender, result} = clientRenderHook(
|
|
499
|
-
({skip}) => useCachedEffect("ID", fakeHandler, {skip}),
|
|
493
|
+
({skip}: any) => useCachedEffect("ID", fakeHandler, {skip}),
|
|
500
494
|
{
|
|
501
495
|
initialProps: {skip: false},
|
|
502
496
|
},
|
|
503
497
|
);
|
|
504
498
|
rerender({skip: true});
|
|
505
|
-
|
|
499
|
+
// @ts-expect-error [FEI-5019] - TS2769 - No overload matches this call.
|
|
500
|
+
await act((): Promise<unknown> => response1);
|
|
506
501
|
|
|
507
502
|
// Assert
|
|
508
503
|
expect(result.all).not.toContainEqual(Status.success("DATA1"));
|
|
@@ -517,15 +512,13 @@ describe("#useCachedEffect", () => {
|
|
|
517
512
|
|
|
518
513
|
// Act
|
|
519
514
|
const {rerender, result} = clientRenderHook(
|
|
520
|
-
({handler}) => useCachedEffect("ID", handler),
|
|
515
|
+
({handler}: any) => useCachedEffect("ID", handler),
|
|
521
516
|
{
|
|
522
517
|
initialProps: {handler: fakeHandler1},
|
|
523
518
|
},
|
|
524
519
|
);
|
|
525
520
|
rerender({handler: fakeHandler2});
|
|
526
|
-
await act((): Promise<
|
|
527
|
-
Promise.all([response1, response2]),
|
|
528
|
-
);
|
|
521
|
+
await act((): Promise<any> => Promise.all([response1, response2]));
|
|
529
522
|
|
|
530
523
|
// Assert
|
|
531
524
|
expect(result.current[0]).toStrictEqual(Status.success("DATA1"));
|
|
@@ -538,17 +531,19 @@ describe("#useCachedEffect", () => {
|
|
|
538
531
|
|
|
539
532
|
// Act
|
|
540
533
|
const {rerender, result} = clientRenderHook(
|
|
541
|
-
({options}) => useCachedEffect("ID", fakeHandler),
|
|
534
|
+
({options}: any) => useCachedEffect("ID", fakeHandler),
|
|
542
535
|
{
|
|
543
536
|
initialProps: {options: undefined},
|
|
544
537
|
},
|
|
545
538
|
);
|
|
546
539
|
rerender({
|
|
540
|
+
// @ts-expect-error [FEI-5019] - TS2322 - Type '{ scope: string; }' is not assignable to type 'undefined'.
|
|
547
541
|
options: {
|
|
548
542
|
scope: "BLAH!",
|
|
549
543
|
},
|
|
550
544
|
});
|
|
551
|
-
|
|
545
|
+
// @ts-expect-error [FEI-5019] - TS2769 - No overload matches this call.
|
|
546
|
+
await act((): Promise<unknown> => response1);
|
|
552
547
|
|
|
553
548
|
// Assert
|
|
554
549
|
expect(result.current[0]).toStrictEqual(Status.success("DATA1"));
|
|
@@ -569,7 +564,7 @@ describe("#useCachedEffect", () => {
|
|
|
569
564
|
result: hookResult,
|
|
570
565
|
waitForNextUpdate,
|
|
571
566
|
} = clientRenderHook(
|
|
572
|
-
({requestId}) =>
|
|
567
|
+
({requestId}: any) =>
|
|
573
568
|
useCachedEffect(requestId, fakeHandler, {
|
|
574
569
|
retainResultOnChange: true,
|
|
575
570
|
}),
|
|
@@ -577,7 +572,8 @@ describe("#useCachedEffect", () => {
|
|
|
577
572
|
initialProps: {requestId: "ID"},
|
|
578
573
|
},
|
|
579
574
|
);
|
|
580
|
-
|
|
575
|
+
// @ts-expect-error [FEI-5019] - TS2769 - No overload matches this call.
|
|
576
|
+
await act((): Promise<unknown> => response1);
|
|
581
577
|
rerender({requestId: "ID2"});
|
|
582
578
|
const [result] = hookResult.current;
|
|
583
579
|
await waitForNextUpdate();
|
|
@@ -599,7 +595,7 @@ describe("#useCachedEffect", () => {
|
|
|
599
595
|
|
|
600
596
|
// Act
|
|
601
597
|
const {rerender, result} = clientRenderHook(
|
|
602
|
-
({requestId}) =>
|
|
598
|
+
({requestId}: any) =>
|
|
603
599
|
useCachedEffect(requestId, fakeHandler, {
|
|
604
600
|
retainResultOnChange: false,
|
|
605
601
|
}),
|
|
@@ -607,7 +603,8 @@ describe("#useCachedEffect", () => {
|
|
|
607
603
|
initialProps: {requestId: "ID"},
|
|
608
604
|
},
|
|
609
605
|
);
|
|
610
|
-
|
|
606
|
+
// @ts-expect-error [FEI-5019] - TS2769 - No overload matches this call.
|
|
607
|
+
await act((): Promise<unknown> => response1);
|
|
611
608
|
rerender({requestId: "ID2"});
|
|
612
609
|
|
|
613
610
|
// Assert
|
|
@@ -616,7 +613,7 @@ describe("#useCachedEffect", () => {
|
|
|
616
613
|
|
|
617
614
|
it.each(allPoliciesBut(FetchPolicy.CacheOnly))(
|
|
618
615
|
"should trigger render when request is fulfilled and onResultChanged is undefined for FetchPolicy.%s",
|
|
619
|
-
async (fetchPolicy) => {
|
|
616
|
+
async (fetchPolicy: any) => {
|
|
620
617
|
// Arrange
|
|
621
618
|
const response = Promise.resolve("DATA");
|
|
622
619
|
const fakeHandler = jest.fn().mockReturnValue(response);
|
|
@@ -629,7 +626,8 @@ describe("#useCachedEffect", () => {
|
|
|
629
626
|
|
|
630
627
|
// Act
|
|
631
628
|
render(<Component />);
|
|
632
|
-
|
|
629
|
+
// @ts-expect-error [FEI-5019] - TS2769 - No overload matches this call.
|
|
630
|
+
await reactAct((): Promise<unknown> => response);
|
|
633
631
|
|
|
634
632
|
// Assert
|
|
635
633
|
expect(renderCount).toBe(2);
|
|
@@ -638,7 +636,7 @@ describe("#useCachedEffect", () => {
|
|
|
638
636
|
|
|
639
637
|
it.each(allPoliciesBut(FetchPolicy.CacheOnly))(
|
|
640
638
|
"should trigger render once per inflight request being fulfilled and onResultChanged is undefined for FetchPolicy.%s",
|
|
641
|
-
async (fetchPolicy) => {
|
|
639
|
+
async (fetchPolicy: any) => {
|
|
642
640
|
// Arrange
|
|
643
641
|
const response = Promise.resolve("DATA");
|
|
644
642
|
const fakeHandler = jest.fn().mockReturnValue(response);
|
|
@@ -659,7 +657,8 @@ describe("#useCachedEffect", () => {
|
|
|
659
657
|
|
|
660
658
|
// Act
|
|
661
659
|
render(<Component />);
|
|
662
|
-
|
|
660
|
+
// @ts-expect-error [FEI-5019] - TS2769 - No overload matches this call.
|
|
661
|
+
await reactAct((): Promise<unknown> => response);
|
|
663
662
|
|
|
664
663
|
// Assert
|
|
665
664
|
expect(renderCount).toBe(2);
|
|
@@ -668,7 +667,7 @@ describe("#useCachedEffect", () => {
|
|
|
668
667
|
|
|
669
668
|
it.each(allPoliciesBut(FetchPolicy.CacheOnly))(
|
|
670
669
|
"should not trigger render when request is fulfilled and onResultChanged is defined for FetchPolicy.%s",
|
|
671
|
-
async (fetchPolicy) => {
|
|
670
|
+
async (fetchPolicy: any) => {
|
|
672
671
|
// Arrange
|
|
673
672
|
const response = Promise.resolve("DATA");
|
|
674
673
|
const fakeHandler = jest.fn().mockReturnValue(response);
|
|
@@ -684,7 +683,8 @@ describe("#useCachedEffect", () => {
|
|
|
684
683
|
|
|
685
684
|
// Act
|
|
686
685
|
render(<Component />);
|
|
687
|
-
|
|
686
|
+
// @ts-expect-error [FEI-5019] - TS2769 - No overload matches this call.
|
|
687
|
+
await reactAct((): Promise<unknown> => response);
|
|
688
688
|
|
|
689
689
|
// Assert
|
|
690
690
|
expect(renderCount).toBe(1);
|
|
@@ -693,7 +693,7 @@ describe("#useCachedEffect", () => {
|
|
|
693
693
|
|
|
694
694
|
it.each(allPoliciesBut(FetchPolicy.CacheOnly))(
|
|
695
695
|
"should call onResultChanged when request is fulfilled and onResultChanged is defined for FetchPolicy.%s",
|
|
696
|
-
async (fetchPolicy) => {
|
|
696
|
+
async (fetchPolicy: any) => {
|
|
697
697
|
// Arrange
|
|
698
698
|
const response = Promise.resolve("DATA");
|
|
699
699
|
const fakeHandler = jest.fn().mockReturnValue(response);
|
|
@@ -706,7 +706,8 @@ describe("#useCachedEffect", () => {
|
|
|
706
706
|
fetchPolicy,
|
|
707
707
|
}),
|
|
708
708
|
);
|
|
709
|
-
|
|
709
|
+
// @ts-expect-error [FEI-5019] - TS2769 - No overload matches this call.
|
|
710
|
+
await act((): Promise<unknown> => response);
|
|
710
711
|
|
|
711
712
|
// Assert
|
|
712
713
|
expect(onResultChanged).toHaveBeenCalledWith(
|
|
@@ -717,7 +718,7 @@ describe("#useCachedEffect", () => {
|
|
|
717
718
|
|
|
718
719
|
it.each(allPoliciesBut(FetchPolicy.CacheOnly))(
|
|
719
720
|
"should call onResultChanged once per inflight request being fulfilled and onResultChanged is defined for FetchPolicy.%s",
|
|
720
|
-
async (fetchPolicy) => {
|
|
721
|
+
async (fetchPolicy: any) => {
|
|
721
722
|
// Arrange
|
|
722
723
|
const response = Promise.resolve("DATA");
|
|
723
724
|
const fakeHandler = jest.fn().mockReturnValue(response);
|
|
@@ -738,7 +739,8 @@ describe("#useCachedEffect", () => {
|
|
|
738
739
|
act(refetch);
|
|
739
740
|
act(refetch);
|
|
740
741
|
act(refetch);
|
|
741
|
-
|
|
742
|
+
// @ts-expect-error [FEI-5019] - TS2769 - No overload matches this call.
|
|
743
|
+
await act((): Promise<unknown> => response);
|
|
742
744
|
|
|
743
745
|
// Assert
|
|
744
746
|
expect(onResultChanged).toHaveBeenCalledTimes(1);
|
package/src/hooks/__tests__/{use-gql-router-context.test.js → use-gql-router-context.test.tsx}
RENAMED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import {renderHook} from "@testing-library/react-hooks";
|
|
4
3
|
|
|
5
|
-
import {GqlRouterContext} from "../../util/gql-router-context
|
|
6
|
-
import {useGqlRouterContext} from "../use-gql-router-context
|
|
4
|
+
import {GqlRouterContext} from "../../util/gql-router-context";
|
|
5
|
+
import {useGqlRouterContext} from "../use-gql-router-context";
|
|
7
6
|
|
|
8
7
|
describe("#useGqlRouterContext", () => {
|
|
9
8
|
it("should throw if there is no GqlRouterContext", () => {
|
|
@@ -27,7 +26,7 @@ describe("#useGqlRouterContext", () => {
|
|
|
27
26
|
defaultContext: {
|
|
28
27
|
foo: "bar",
|
|
29
28
|
},
|
|
30
|
-
};
|
|
29
|
+
} as const;
|
|
31
30
|
const Wrapper = ({children}: any) => (
|
|
32
31
|
<GqlRouterContext.Provider value={baseContext}>
|
|
33
32
|
{children}
|
|
@@ -50,7 +49,7 @@ describe("#useGqlRouterContext", () => {
|
|
|
50
49
|
defaultContext: {
|
|
51
50
|
foo: "bar",
|
|
52
51
|
},
|
|
53
|
-
};
|
|
52
|
+
} as const;
|
|
54
53
|
const Wrapper = ({children}: any) => (
|
|
55
54
|
<GqlRouterContext.Provider value={baseContext}>
|
|
56
55
|
{children}
|
|
@@ -76,7 +75,7 @@ describe("#useGqlRouterContext", () => {
|
|
|
76
75
|
defaultContext: {
|
|
77
76
|
foo: "bar",
|
|
78
77
|
},
|
|
79
|
-
};
|
|
78
|
+
} as const;
|
|
80
79
|
const Wrapper = ({children}: any) => (
|
|
81
80
|
<GqlRouterContext.Provider value={baseContext}>
|
|
82
81
|
{children}
|
|
@@ -85,7 +84,7 @@ describe("#useGqlRouterContext", () => {
|
|
|
85
84
|
|
|
86
85
|
// Act
|
|
87
86
|
const wrapper = renderHook(
|
|
88
|
-
({overrides}) => useGqlRouterContext(overrides),
|
|
87
|
+
({overrides}: any) => useGqlRouterContext(overrides),
|
|
89
88
|
{
|
|
90
89
|
wrapper: Wrapper,
|
|
91
90
|
initialProps: {},
|
|
@@ -106,7 +105,7 @@ describe("#useGqlRouterContext", () => {
|
|
|
106
105
|
defaultContext: {
|
|
107
106
|
foo: "bar",
|
|
108
107
|
},
|
|
109
|
-
};
|
|
108
|
+
} as const;
|
|
110
109
|
const Wrapper = ({children}: any) => (
|
|
111
110
|
<GqlRouterContext.Provider value={baseContext}>
|
|
112
111
|
{children}
|
|
@@ -115,7 +114,7 @@ describe("#useGqlRouterContext", () => {
|
|
|
115
114
|
|
|
116
115
|
// Act
|
|
117
116
|
const wrapper = renderHook(
|
|
118
|
-
({overrides}) => useGqlRouterContext(overrides),
|
|
117
|
+
({overrides}: any) => useGqlRouterContext(overrides),
|
|
119
118
|
{
|
|
120
119
|
wrapper: Wrapper,
|
|
121
120
|
initialProps: {
|
|
@@ -124,6 +123,7 @@ describe("#useGqlRouterContext", () => {
|
|
|
124
123
|
},
|
|
125
124
|
);
|
|
126
125
|
const result1 = wrapper.result.current;
|
|
126
|
+
// @ts-expect-error [FEI-5019] - TS2741 - Property 'fiz' is missing in type '{}' but required in type '{ fiz: string; }'.
|
|
127
127
|
wrapper.rerender({overrides: {}});
|
|
128
128
|
const result2 = wrapper.result.current;
|
|
129
129
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import {renderHook} from "@testing-library/react-hooks";
|
|
4
3
|
|
|
5
|
-
import * as GetGqlDataFromResponse from "../../util/get-gql-data-from-response
|
|
6
|
-
import {GqlRouterContext} from "../../util/gql-router-context
|
|
7
|
-
import {useGql} from "../use-gql
|
|
4
|
+
import * as GetGqlDataFromResponse from "../../util/get-gql-data-from-response";
|
|
5
|
+
import {GqlRouterContext} from "../../util/gql-router-context";
|
|
6
|
+
import {useGql} from "../use-gql";
|
|
8
7
|
|
|
9
8
|
describe("#useGql", () => {
|
|
10
9
|
beforeEach(() => {
|
|
@@ -30,13 +29,13 @@ describe("#useGql", () => {
|
|
|
30
29
|
const gqlRouterContext = {
|
|
31
30
|
fetch: jest.fn(),
|
|
32
31
|
defaultContext: {},
|
|
33
|
-
};
|
|
32
|
+
} as const;
|
|
34
33
|
|
|
35
34
|
// Act
|
|
36
35
|
const {
|
|
37
36
|
result: {current: result},
|
|
38
37
|
} = renderHook(() => useGql(), {
|
|
39
|
-
wrapper: ({children}) => (
|
|
38
|
+
wrapper: ({children}: any) => (
|
|
40
39
|
<GqlRouterContext.Provider value={gqlRouterContext}>
|
|
41
40
|
{children}
|
|
42
41
|
</GqlRouterContext.Provider>
|
|
@@ -58,18 +57,18 @@ describe("#useGql", () => {
|
|
|
58
57
|
});
|
|
59
58
|
const fetchFake = jest
|
|
60
59
|
.fn()
|
|
61
|
-
.mockResolvedValue(
|
|
60
|
+
.mockResolvedValue("FAKE_RESPONSE" as any);
|
|
62
61
|
const gqlRouterContext = {
|
|
63
62
|
fetch: fetchFake,
|
|
64
63
|
defaultContext: {
|
|
65
64
|
a: "defaultA",
|
|
66
65
|
b: "defaultB",
|
|
67
66
|
},
|
|
68
|
-
};
|
|
67
|
+
} as const;
|
|
69
68
|
const {
|
|
70
69
|
result: {current: gqlFetch},
|
|
71
70
|
} = renderHook(() => useGql(), {
|
|
72
|
-
wrapper: ({children}) => (
|
|
71
|
+
wrapper: ({children}: any) => (
|
|
73
72
|
<GqlRouterContext.Provider value={gqlRouterContext}>
|
|
74
73
|
{children}
|
|
75
74
|
</GqlRouterContext.Provider>
|
|
@@ -78,14 +77,14 @@ describe("#useGql", () => {
|
|
|
78
77
|
const gqlOp = {
|
|
79
78
|
type: "query",
|
|
80
79
|
id: "MyQuery",
|
|
81
|
-
};
|
|
80
|
+
} as const;
|
|
82
81
|
const gqlOpContext = {
|
|
83
82
|
a: undefined, // This should not get included.
|
|
84
83
|
b: "overrideB",
|
|
85
|
-
};
|
|
84
|
+
} as const;
|
|
86
85
|
const gqlOpVariables = {
|
|
87
86
|
var1: "val1",
|
|
88
|
-
};
|
|
87
|
+
} as const;
|
|
89
88
|
|
|
90
89
|
// Act
|
|
91
90
|
await gqlFetch(gqlOp, {
|
|
@@ -108,13 +107,13 @@ describe("#useGql", () => {
|
|
|
108
107
|
some: "data",
|
|
109
108
|
});
|
|
110
109
|
const gqlRouterContext = {
|
|
111
|
-
fetch: jest.fn().mockResolvedValue(
|
|
110
|
+
fetch: jest.fn().mockResolvedValue("FAKE_RESPONSE" as any),
|
|
112
111
|
defaultContext: {},
|
|
113
|
-
};
|
|
112
|
+
} as const;
|
|
114
113
|
const {
|
|
115
114
|
result: {current: gqlFetch},
|
|
116
115
|
} = renderHook(() => useGql(), {
|
|
117
|
-
wrapper: ({children}) => (
|
|
116
|
+
wrapper: ({children}: any) => (
|
|
118
117
|
<GqlRouterContext.Provider value={gqlRouterContext}>
|
|
119
118
|
{children}
|
|
120
119
|
</GqlRouterContext.Provider>
|
|
@@ -123,7 +122,7 @@ describe("#useGql", () => {
|
|
|
123
122
|
const gqlOp = {
|
|
124
123
|
type: "query",
|
|
125
124
|
id: "MyQuery",
|
|
126
|
-
};
|
|
125
|
+
} as const;
|
|
127
126
|
|
|
128
127
|
// Act
|
|
129
128
|
await gqlFetch(gqlOp);
|
|
@@ -141,13 +140,13 @@ describe("#useGql", () => {
|
|
|
141
140
|
"getGqlDataFromResponse",
|
|
142
141
|
).mockRejectedValue(new Error("FAKE_ERROR"));
|
|
143
142
|
const gqlRouterContext = {
|
|
144
|
-
fetch: jest.fn().mockResolvedValue(
|
|
143
|
+
fetch: jest.fn().mockResolvedValue("FAKE_RESPONSE" as any),
|
|
145
144
|
defaultContext: {},
|
|
146
|
-
};
|
|
145
|
+
} as const;
|
|
147
146
|
const {
|
|
148
147
|
result: {current: gqlFetch},
|
|
149
148
|
} = renderHook(() => useGql(), {
|
|
150
|
-
wrapper: ({children}) => (
|
|
149
|
+
wrapper: ({children}: any) => (
|
|
151
150
|
<GqlRouterContext.Provider value={gqlRouterContext}>
|
|
152
151
|
{children}
|
|
153
152
|
</GqlRouterContext.Provider>
|
|
@@ -156,7 +155,7 @@ describe("#useGql", () => {
|
|
|
156
155
|
const gqlOp = {
|
|
157
156
|
type: "query",
|
|
158
157
|
id: "MyQuery",
|
|
159
|
-
};
|
|
158
|
+
} as const;
|
|
160
159
|
|
|
161
160
|
// Act
|
|
162
161
|
const act = gqlFetch(gqlOp);
|
|
@@ -176,13 +175,13 @@ describe("#useGql", () => {
|
|
|
176
175
|
some: "data",
|
|
177
176
|
});
|
|
178
177
|
const gqlRouterContext = {
|
|
179
|
-
fetch: jest.fn().mockResolvedValue(
|
|
178
|
+
fetch: jest.fn().mockResolvedValue("FAKE_RESPONSE" as any),
|
|
180
179
|
defaultContext: {},
|
|
181
|
-
};
|
|
180
|
+
} as const;
|
|
182
181
|
const {
|
|
183
182
|
result: {current: gqlFetch},
|
|
184
183
|
} = renderHook(() => useGql(), {
|
|
185
|
-
wrapper: ({children}) => (
|
|
184
|
+
wrapper: ({children}: any) => (
|
|
186
185
|
<GqlRouterContext.Provider value={gqlRouterContext}>
|
|
187
186
|
{children}
|
|
188
187
|
</GqlRouterContext.Provider>
|
|
@@ -191,7 +190,7 @@ describe("#useGql", () => {
|
|
|
191
190
|
const gqlOp = {
|
|
192
191
|
type: "mutation",
|
|
193
192
|
id: "MyMutation",
|
|
194
|
-
};
|
|
193
|
+
} as const;
|
|
195
194
|
|
|
196
195
|
// Act
|
|
197
196
|
const result = await gqlFetch(gqlOp);
|