@hyper-fetch/core 8.1.1 → 8.2.2
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/README.md +137 -52
- package/__tests__/e2e/e2e.advanced.spec.ts +7 -7
- package/__tests__/features/adapter/adapter.base.spec.ts +2 -1
- package/__tests__/features/adapter/adapter.bindings.spec.ts +4 -4
- package/__tests__/features/adapter/adapter.browser.spec.ts +0 -1
- package/__tests__/features/adapter/adapter.server.spec.ts +4 -5
- package/__tests__/features/adapter/adapter.utils.spec.ts +6 -7
- package/__tests__/features/cache/cache.base.spec.ts +7 -7
- package/__tests__/features/cache/cache.events.spec.ts +15 -15
- package/__tests__/features/cache/cache.garbage-collector.spec.ts +18 -18
- package/__tests__/features/cache/cache.lazy-storage.spec.ts +8 -8
- package/__tests__/features/cache/cache.modes.spec.ts +7 -6
- package/__tests__/features/cache/cache.scoping.spec.ts +12 -8
- package/__tests__/features/cache/cache.typescript.spec.ts +2 -2
- package/__tests__/features/cache/cache.utils.spec.ts +14 -14
- package/__tests__/features/client/client.auth.spec.ts +0 -1
- package/__tests__/features/client/client.base.spec.ts +2 -3
- package/__tests__/features/client/client.from-json.spec.ts +0 -1
- package/__tests__/features/client/client.hydration.spec.ts +5 -5
- package/__tests__/features/client/client.interceptor.spec.ts +3 -3
- package/__tests__/features/client/client.methods.spec.ts +5 -5
- package/__tests__/features/client/client.middleware.spec.ts +2 -2
- package/__tests__/features/client/client.utils.spec.ts +16 -15
- package/__tests__/features/dispatcher/dispatcher.base.spec.ts +3 -3
- package/__tests__/features/dispatcher/dispatcher.custom-storage.spec.ts +4 -5
- package/__tests__/features/dispatcher/dispatcher.events.spec.ts +4 -4
- package/__tests__/features/dispatcher/dispatcher.queue.spec.ts +13 -13
- package/__tests__/features/dispatcher/dispatcher.requests.spec.ts +10 -10
- package/__tests__/features/dispatcher/dispatcher.utils.spec.ts +35 -8
- package/__tests__/features/managers/app/app.manager.base.spec.ts +2 -3
- package/__tests__/features/managers/logger/logger.base.spec.ts +1 -2
- package/__tests__/features/managers/request/request.manager.base.spec.ts +8 -9
- package/__tests__/features/managers/request/request.manager.events.spec.ts +1 -2
- package/__tests__/features/mocker/mocker.base.spec.ts +6 -6
- package/__tests__/features/plugin/plugin.base.spec.ts +1 -2
- package/__tests__/features/request/request.cloning.spec.ts +0 -1
- package/__tests__/features/request/request.deduplicate-defaults.spec.ts +79 -0
- package/__tests__/features/request/request.retry-on-error.spec.ts +1 -2
- package/__tests__/features/request/request.sending.spec.ts +73 -24
- package/__tests__/features/request/request.setters.spec.ts +4 -3
- package/__tests__/features/request/request.typescript.spec.ts +0 -1
- package/__tests__/features/request/request.utils.spec.ts +1 -0
- package/__tests__/features/sdk/sdk.base.spec.ts +7 -12
- package/__tests__/features/sdk/sdk.configuration.spec.ts +5 -7
- package/__tests__/features/sdk/sdk.request-fields.spec.ts +80 -0
- package/__tests__/features/sdk/sdk.types.spec.ts +283 -0
- package/__tests__/shared/callbacks.shared.ts +1 -1
- package/__tests__/tsconfig.json +4 -17
- package/__tests__/utils/adapter.utils.ts +1 -2
- package/__tests__/utils/callbacks.utils.ts +1 -2
- package/__tests__/utils/dispatcher.utils.ts +1 -1
- package/__tests__/vitest.setup.ts +1 -1
- package/dist/adapter/adapter.d.ts +22 -5
- package/dist/adapter/adapter.d.ts.map +1 -1
- package/dist/adapter/adapter.types.d.ts +9 -1
- package/dist/adapter/adapter.types.d.ts.map +1 -1
- package/dist/adapter/adapter.utils.d.ts.map +1 -1
- package/dist/cache/cache.d.ts +6 -9
- package/dist/cache/cache.d.ts.map +1 -1
- package/dist/cache/cache.events.d.ts +7 -4
- package/dist/cache/cache.events.d.ts.map +1 -1
- package/dist/cache/cache.types.d.ts +1 -0
- package/dist/cache/cache.types.d.ts.map +1 -1
- package/dist/client/client.create.d.ts +1 -1
- package/dist/client/client.create.d.ts.map +1 -1
- package/dist/client/client.d.ts +8 -4
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.types.d.ts +1 -1
- package/dist/client/client.types.d.ts.map +1 -1
- package/dist/client/client.utils.d.ts.map +1 -1
- package/dist/constants/http.constants.d.ts +5 -1
- package/dist/constants/http.constants.d.ts.map +1 -1
- package/dist/constants/time.constants.d.ts.map +1 -1
- package/dist/dispatcher/dispatcher.d.ts +4 -4
- package/dist/dispatcher/dispatcher.d.ts.map +1 -1
- package/dist/dispatcher/dispatcher.events.d.ts +1 -1
- package/dist/dispatcher/dispatcher.events.d.ts.map +1 -1
- package/dist/dispatcher/dispatcher.utils.d.ts +1 -1
- package/dist/dispatcher/dispatcher.utils.d.ts.map +1 -1
- package/dist/http-adapter/http-adapter.constants.d.ts.map +1 -1
- package/dist/http-adapter/http-adapter.d.ts.map +1 -1
- package/dist/http-adapter/http-adapter.fetch.d.ts +2 -2
- package/dist/http-adapter/http-adapter.fetch.d.ts.map +1 -1
- package/dist/http-adapter/http-adapter.types.d.ts +2 -2
- package/dist/http-adapter/http-adapter.types.d.ts.map +1 -1
- package/dist/http-adapter/http-adapter.utils.d.ts.map +1 -1
- package/dist/index.mjs +2382 -2301
- package/dist/index.mjs.map +1 -1
- package/dist/managers/app/app.manager.constants.d.ts +1 -1
- package/dist/managers/app/app.manager.constants.d.ts.map +1 -1
- package/dist/managers/app/app.manager.d.ts +1 -1
- package/dist/managers/app/app.manager.d.ts.map +1 -1
- package/dist/managers/app/app.manager.events.d.ts +9 -0
- package/dist/managers/app/app.manager.events.d.ts.map +1 -1
- package/dist/managers/logger/logger.manager.d.ts +1 -1
- package/dist/managers/logger/logger.manager.d.ts.map +1 -1
- package/dist/managers/request/request.manager.d.ts.map +1 -1
- package/dist/managers/request/request.manager.events.d.ts +14 -3
- package/dist/managers/request/request.manager.events.d.ts.map +1 -1
- package/dist/mocker/mocker.types.d.ts +1 -0
- package/dist/mocker/mocker.types.d.ts.map +1 -1
- package/dist/plugin/plugin.d.ts +17 -1
- package/dist/plugin/plugin.d.ts.map +1 -1
- package/dist/plugin/plugin.types.d.ts +5 -4
- package/dist/plugin/plugin.types.d.ts.map +1 -1
- package/dist/request/request.d.ts +33 -4
- package/dist/request/request.d.ts.map +1 -1
- package/dist/request/request.hooks.d.ts +2 -2
- package/dist/request/request.hooks.d.ts.map +1 -1
- package/dist/request/request.types.d.ts +92 -5
- package/dist/request/request.types.d.ts.map +1 -1
- package/dist/request/request.utils.d.ts.map +1 -1
- package/dist/sdk/sdk.d.ts +25 -5
- package/dist/sdk/sdk.d.ts.map +1 -1
- package/dist/types/http.types.d.ts +1 -1
- package/dist/types/http.types.d.ts.map +1 -1
- package/dist/types/request.types.d.ts +2 -2
- package/dist/types/request.types.d.ts.map +1 -1
- package/dist/utils/emitter.utils.d.ts +1 -1
- package/dist/utils/emitter.utils.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/adapter/adapter.bindings.ts +14 -14
- package/src/adapter/adapter.ts +28 -10
- package/src/adapter/adapter.types.ts +10 -1
- package/src/adapter/adapter.utils.ts +5 -5
- package/src/cache/cache.events.ts +7 -5
- package/src/cache/cache.ts +14 -17
- package/src/cache/cache.types.ts +1 -0
- package/src/client/client.create.ts +1 -1
- package/src/client/client.ts +14 -9
- package/src/client/client.types.ts +2 -2
- package/src/client/client.utils.ts +3 -2
- package/src/constants/http.constants.ts +5 -0
- package/src/constants/time.constants.ts +1 -1
- package/src/dispatcher/dispatcher.events.ts +1 -2
- package/src/dispatcher/dispatcher.ts +13 -13
- package/src/dispatcher/dispatcher.utils.ts +10 -4
- package/src/http-adapter/http-adapter.constants.ts +1 -0
- package/src/http-adapter/http-adapter.fetch.ts +19 -9
- package/src/http-adapter/http-adapter.ts +2 -1
- package/src/http-adapter/http-adapter.types.ts +3 -2
- package/src/http-adapter/http-adapter.utils.ts +15 -11
- package/src/managers/app/app.manager.constants.ts +2 -1
- package/src/managers/app/app.manager.events.ts +9 -1
- package/src/managers/app/app.manager.ts +1 -1
- package/src/managers/app/app.manager.utils.ts +2 -2
- package/src/managers/logger/logger.manager.ts +1 -2
- package/src/managers/request/request.manager.events.ts +14 -12
- package/src/managers/request/request.manager.ts +4 -4
- package/src/mocker/mocker.ts +2 -2
- package/src/mocker/mocker.types.ts +1 -0
- package/src/plugin/plugin.ts +17 -1
- package/src/plugin/plugin.types.ts +5 -4
- package/src/request/request.hooks.ts +6 -5
- package/src/request/request.ts +77 -34
- package/src/request/request.types.ts +107 -5
- package/src/request/request.utils.ts +17 -16
- package/src/sdk/sdk.ts +79 -23
- package/src/types/http.types.ts +1 -1
- package/src/types/request.types.ts +3 -2
- package/src/utils/emitter.utils.ts +1 -1
- package/src/utils/uuid.utils.ts +1 -1
- package/tsconfig.json +30 -2
- package/vite.config.ts +14 -20
- package/.eslintrc.cjs +0 -12
- package/tsconfig.base.json +0 -7
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { waitFor } from "@testing-library/dom";
|
|
2
|
-
|
|
3
2
|
import type { ResponseSuccessType } from "adapter";
|
|
4
|
-
import type { ResponseDetailsType } from "managers";
|
|
5
|
-
import { createCache, createLazyCacheAdapter } from "../../utils";
|
|
6
3
|
import { Client } from "client";
|
|
7
4
|
import type { HttpAdapterType } from "http-adapter";
|
|
8
5
|
import { xhrExtra } from "http-adapter";
|
|
6
|
+
import type { ResponseDetailsType } from "managers";
|
|
9
7
|
import { scopeKey } from "request";
|
|
10
8
|
|
|
9
|
+
import { createCache, createLazyCacheAdapter } from "../../utils";
|
|
10
|
+
|
|
11
11
|
describe("Cache [ Scoping ]", () => {
|
|
12
12
|
const response: ResponseSuccessType<unknown, HttpAdapterType> = {
|
|
13
13
|
data: { id: 1 },
|
|
@@ -20,10 +20,10 @@ describe("Cache [ Scoping ]", () => {
|
|
|
20
20
|
};
|
|
21
21
|
const details: ResponseDetailsType = {
|
|
22
22
|
retries: 0,
|
|
23
|
-
requestTimestamp:
|
|
24
|
-
responseTimestamp:
|
|
25
|
-
addedTimestamp:
|
|
26
|
-
triggerTimestamp:
|
|
23
|
+
requestTimestamp: Date.now(),
|
|
24
|
+
responseTimestamp: Date.now(),
|
|
25
|
+
addedTimestamp: Date.now(),
|
|
26
|
+
triggerTimestamp: Date.now(),
|
|
27
27
|
isCanceled: false,
|
|
28
28
|
isOffline: false,
|
|
29
29
|
willRetry: false,
|
|
@@ -41,7 +41,11 @@ describe("Cache [ Scoping ]", () => {
|
|
|
41
41
|
cache.set(a, { ...response, ...details, data: { id: 1 } });
|
|
42
42
|
cache.set(b, { ...response, ...details, data: { id: 2 } });
|
|
43
43
|
|
|
44
|
-
cache.set(a, (prev) => ({
|
|
44
|
+
cache.set(a, (prev) => ({
|
|
45
|
+
...response,
|
|
46
|
+
...details,
|
|
47
|
+
data: { id: ((prev?.data as { id: number } | undefined)?.id ?? 0) + 10 },
|
|
48
|
+
}));
|
|
45
49
|
|
|
46
50
|
expect(cache.get(scopeKey(base.cacheKey, "a"))?.data).toStrictEqual({ id: 11 });
|
|
47
51
|
expect(cache.get(scopeKey(base.cacheKey, "b"))?.data).toStrictEqual({ id: 2 });
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
2
|
import { expectFunctionParametersType, expectNotFunctionParametersType } from "@hyper-fetch/testing";
|
|
3
|
-
|
|
4
3
|
import type { ResponseSuccessType } from "adapter";
|
|
5
|
-
import type { ResponseDetailsType } from "managers";
|
|
6
4
|
import { Client } from "client";
|
|
7
5
|
import type { HttpAdapterType } from "http-adapter";
|
|
8
6
|
import { xhrExtra } from "http-adapter";
|
|
7
|
+
import type { ResponseDetailsType } from "managers";
|
|
8
|
+
|
|
9
9
|
import { createCache } from "../../utils";
|
|
10
10
|
|
|
11
11
|
interface UserResponse {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { getCacheData, getCacheByKey, getInvalidateByKey } from "cache";
|
|
2
1
|
import type { ResponseErrorType, ResponseSuccessType } from "adapter";
|
|
3
|
-
import
|
|
2
|
+
import { getCacheData, getCacheByKey, getInvalidateByKey } from "cache";
|
|
4
3
|
import type { HttpAdapterType } from "http-adapter";
|
|
5
4
|
import { xhrExtra } from "http-adapter";
|
|
5
|
+
import type { ResponseDetailsType } from "managers";
|
|
6
6
|
|
|
7
7
|
describe("Cache [ Utils ]", () => {
|
|
8
8
|
describe("when getCacheData function is used", () => {
|
|
@@ -20,10 +20,10 @@ describe("Cache [ Utils ]", () => {
|
|
|
20
20
|
success: false,
|
|
21
21
|
extra: xhrExtra,
|
|
22
22
|
retries: 0,
|
|
23
|
-
requestTimestamp:
|
|
24
|
-
responseTimestamp:
|
|
25
|
-
addedTimestamp:
|
|
26
|
-
triggerTimestamp:
|
|
23
|
+
requestTimestamp: Date.now(),
|
|
24
|
+
responseTimestamp: Date.now(),
|
|
25
|
+
addedTimestamp: Date.now(),
|
|
26
|
+
triggerTimestamp: Date.now(),
|
|
27
27
|
isCanceled: false,
|
|
28
28
|
isOffline: false,
|
|
29
29
|
willRetry: false,
|
|
@@ -54,10 +54,10 @@ describe("Cache [ Utils ]", () => {
|
|
|
54
54
|
success: true,
|
|
55
55
|
extra: xhrExtra,
|
|
56
56
|
retries: 0,
|
|
57
|
-
requestTimestamp:
|
|
58
|
-
responseTimestamp:
|
|
59
|
-
addedTimestamp:
|
|
60
|
-
triggerTimestamp:
|
|
57
|
+
requestTimestamp: Date.now(),
|
|
58
|
+
responseTimestamp: Date.now(),
|
|
59
|
+
addedTimestamp: Date.now(),
|
|
60
|
+
triggerTimestamp: Date.now(),
|
|
61
61
|
isCanceled: false,
|
|
62
62
|
isOffline: false,
|
|
63
63
|
willRetry: false,
|
|
@@ -69,10 +69,10 @@ describe("Cache [ Utils ]", () => {
|
|
|
69
69
|
success: true,
|
|
70
70
|
extra: xhrExtra,
|
|
71
71
|
retries: 0,
|
|
72
|
-
requestTimestamp:
|
|
73
|
-
responseTimestamp:
|
|
74
|
-
addedTimestamp:
|
|
75
|
-
triggerTimestamp:
|
|
72
|
+
requestTimestamp: Date.now(),
|
|
73
|
+
responseTimestamp: Date.now(),
|
|
74
|
+
addedTimestamp: Date.now(),
|
|
75
|
+
triggerTimestamp: Date.now(),
|
|
76
76
|
isCanceled: false,
|
|
77
77
|
isOffline: false,
|
|
78
78
|
willRetry: false,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { createHttpMockingServer } from "@hyper-fetch/testing";
|
|
2
|
-
|
|
2
|
+
import { Adapter } from "adapter";
|
|
3
3
|
import { Cache } from "cache";
|
|
4
|
+
import { Client } from "client";
|
|
4
5
|
import { Dispatcher } from "dispatcher";
|
|
5
6
|
import { AppManager } from "managers";
|
|
6
|
-
import { Client } from "client";
|
|
7
|
-
import { Adapter } from "adapter";
|
|
8
7
|
|
|
9
8
|
const { resetMocks, startServer, stopServer } = createHttpMockingServer();
|
|
10
9
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Client } from "client";
|
|
2
1
|
import type { CacheValueType } from "cache";
|
|
2
|
+
import { Client } from "client";
|
|
3
3
|
import { xhrExtra } from "http-adapter";
|
|
4
4
|
import { scopeKey } from "request";
|
|
5
5
|
|
|
@@ -69,10 +69,10 @@ describe("Client [ Hydration ]", () => {
|
|
|
69
69
|
error: null,
|
|
70
70
|
success: true,
|
|
71
71
|
extra: {},
|
|
72
|
-
responseTimestamp:
|
|
73
|
-
requestTimestamp:
|
|
74
|
-
addedTimestamp:
|
|
75
|
-
triggerTimestamp:
|
|
72
|
+
responseTimestamp: Date.now(),
|
|
73
|
+
requestTimestamp: Date.now(),
|
|
74
|
+
addedTimestamp: Date.now(),
|
|
75
|
+
triggerTimestamp: Date.now(),
|
|
76
76
|
retries: 0,
|
|
77
77
|
isCanceled: false,
|
|
78
78
|
isOffline: false,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createHttpMockingServer } from "@hyper-fetch/testing";
|
|
2
|
-
|
|
3
|
-
import { interceptorCallback } from "../../utils";
|
|
4
|
-
import { testCallbacksExecution } from "../../shared";
|
|
5
2
|
import { Client } from "client";
|
|
6
3
|
import { xhrExtra } from "http-adapter";
|
|
7
4
|
|
|
5
|
+
import { testCallbacksExecution } from "../../shared";
|
|
6
|
+
import { interceptorCallback } from "../../utils";
|
|
7
|
+
|
|
8
8
|
const { resetMocks, startServer, stopServer, mockRequest } = createHttpMockingServer();
|
|
9
9
|
|
|
10
10
|
describe("Client [ Interceptor ]", () => {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createHttpMockingServer } from "@hyper-fetch/testing";
|
|
2
|
-
|
|
3
|
-
import { Plugin } from "plugin";
|
|
4
2
|
import { Client } from "client";
|
|
3
|
+
import type { FetchAdapterOptionsType, QueryStringifyOptionsType } from "http-adapter";
|
|
4
|
+
import { LoggerManager } from "managers";
|
|
5
|
+
import { Plugin } from "plugin";
|
|
5
6
|
import type { RequestOptionsType } from "request";
|
|
6
7
|
import { Request } from "request";
|
|
7
|
-
|
|
8
|
+
|
|
8
9
|
import { createAdapter, interceptorCallback, middlewareCallback } from "../../utils";
|
|
9
|
-
import type { FetchAdapterOptionsType, QueryStringifyOptionsType } from "http-adapter";
|
|
10
10
|
|
|
11
11
|
const { resetMocks, startServer, stopServer } = createHttpMockingServer();
|
|
12
12
|
|
|
@@ -36,7 +36,7 @@ describe("Client [ Methods ]", () => {
|
|
|
36
36
|
expect(req.method).toBe("POST");
|
|
37
37
|
});
|
|
38
38
|
it("should assign default adapter config [setAdapterDefaultOptions]", async () => {
|
|
39
|
-
const options: FetchAdapterOptionsType = { timeout:
|
|
39
|
+
const options: FetchAdapterOptionsType = { timeout: 12_312_312 };
|
|
40
40
|
client.adapter.setAdapterDefaults(() => options);
|
|
41
41
|
|
|
42
42
|
expect(client.adapter.unstable_getAdapterDefaults?.(request)).toEqual(options);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createHttpMockingServer } from "@hyper-fetch/testing";
|
|
2
|
+
import { Client } from "client";
|
|
2
3
|
|
|
3
|
-
import { middlewareCallback } from "../../utils";
|
|
4
4
|
import { testCallbacksExecution } from "../../shared";
|
|
5
|
-
import {
|
|
5
|
+
import { middlewareCallback } from "../../utils";
|
|
6
6
|
|
|
7
7
|
const { resetMocks, startServer, stopServer, mockRequest } = createHttpMockingServer();
|
|
8
8
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createHttpMockingServer } from "@hyper-fetch/testing";
|
|
2
|
-
|
|
3
2
|
import { Client, interceptRequest, interceptResponse, stringifyDefaultOptions } from "client";
|
|
4
3
|
import { stringifyQueryParams } from "http-adapter";
|
|
5
4
|
|
|
@@ -152,7 +151,7 @@ describe("Client [ Utils ]", () => {
|
|
|
152
151
|
describe("When using headerMapper", () => {
|
|
153
152
|
it("should assign default headers with headers mapper", async () => {
|
|
154
153
|
const defaultHeaders = {};
|
|
155
|
-
const headers = client.adapter.unstable_headerMapper(request
|
|
154
|
+
const headers = client.adapter.unstable_headerMapper(request);
|
|
156
155
|
|
|
157
156
|
expect(headers).toEqual(defaultHeaders);
|
|
158
157
|
});
|
|
@@ -160,14 +159,14 @@ describe("Client [ Utils ]", () => {
|
|
|
160
159
|
const defaultHeaders = {};
|
|
161
160
|
const data = new FormData();
|
|
162
161
|
const formDataRequest = request.setPayload(data);
|
|
163
|
-
const headers = client.adapter.unstable_headerMapper(formDataRequest
|
|
162
|
+
const headers = client.adapter.unstable_headerMapper(formDataRequest);
|
|
164
163
|
|
|
165
164
|
expect(headers).toEqual(defaultHeaders);
|
|
166
165
|
});
|
|
167
166
|
it("should not re-assign form data headers", async () => {
|
|
168
167
|
const defaultHeaders = { "Content-Type": "some-custom-format" };
|
|
169
168
|
const formDataRequest = request.setHeaders(defaultHeaders);
|
|
170
|
-
const headers = client.adapter.unstable_headerMapper(formDataRequest
|
|
169
|
+
const headers = client.adapter.unstable_headerMapper(formDataRequest);
|
|
171
170
|
|
|
172
171
|
expect(headers).toEqual(defaultHeaders);
|
|
173
172
|
});
|
|
@@ -175,7 +174,7 @@ describe("Client [ Utils ]", () => {
|
|
|
175
174
|
const defaultHeaders = { "Content-Type": "application/json" };
|
|
176
175
|
const data = { data: [] } as any;
|
|
177
176
|
const formDataRequest = request.setPayload(data);
|
|
178
|
-
const headers = client.adapter.unstable_headerMapper(formDataRequest
|
|
177
|
+
const headers = client.adapter.unstable_headerMapper(formDataRequest);
|
|
179
178
|
|
|
180
179
|
expect(headers).toEqual(defaultHeaders);
|
|
181
180
|
});
|
|
@@ -184,29 +183,30 @@ describe("Client [ Utils ]", () => {
|
|
|
184
183
|
describe("When using payloadMapper", () => {
|
|
185
184
|
it("should allow to stringify payload", async () => {
|
|
186
185
|
const data = { data: [] };
|
|
187
|
-
const payload = client.adapter.unstable_payloadMapper(data
|
|
186
|
+
const payload = client.adapter.unstable_payloadMapper(data);
|
|
188
187
|
|
|
189
188
|
expect(payload).toEqual(JSON.stringify(data));
|
|
190
189
|
});
|
|
191
190
|
it("should not stringify FormData payload", async () => {
|
|
192
191
|
const data = new FormData();
|
|
193
|
-
const payload = client.adapter.unstable_payloadMapper(data
|
|
192
|
+
const payload = client.adapter.unstable_payloadMapper(data);
|
|
194
193
|
|
|
195
194
|
expect(payload).toEqual(data);
|
|
196
195
|
});
|
|
197
196
|
it("should stringify null payload", async () => {
|
|
198
197
|
const data = null;
|
|
199
|
-
const payload = client.adapter.unstable_payloadMapper(data
|
|
198
|
+
const payload = client.adapter.unstable_payloadMapper(data);
|
|
200
199
|
|
|
201
200
|
expect(payload).toEqual(JSON.stringify(data));
|
|
202
201
|
});
|
|
203
202
|
it("should not stringify undefined payload", async () => {
|
|
204
|
-
|
|
203
|
+
// oxlint-disable-next-line unicorn/no-useless-undefined
|
|
204
|
+
const payload = client.adapter.unstable_payloadMapper(undefined);
|
|
205
205
|
|
|
206
206
|
expect(payload).toBeUndefined();
|
|
207
207
|
});
|
|
208
208
|
it("should not stringify invalid payload", async () => {
|
|
209
|
-
const payload = client.adapter.unstable_payloadMapper(() => null
|
|
209
|
+
const payload = client.adapter.unstable_payloadMapper(() => null);
|
|
210
210
|
expect(payload).toBeUndefined();
|
|
211
211
|
});
|
|
212
212
|
});
|
|
@@ -214,24 +214,25 @@ describe("Client [ Utils ]", () => {
|
|
|
214
214
|
describe("When using stringifyValue util", () => {
|
|
215
215
|
it("should allow to stringify payload", async () => {
|
|
216
216
|
const data = { data: [] };
|
|
217
|
-
const payload = client.adapter.unstable_payloadMapper(data
|
|
217
|
+
const payload = client.adapter.unstable_payloadMapper(data);
|
|
218
218
|
|
|
219
219
|
expect(payload).toEqual(JSON.stringify(data));
|
|
220
220
|
});
|
|
221
221
|
it("should not stringify FormData payload", async () => {
|
|
222
222
|
const data = new FormData();
|
|
223
|
-
const payload = client.adapter.unstable_payloadMapper(data
|
|
223
|
+
const payload = client.adapter.unstable_payloadMapper(data);
|
|
224
224
|
|
|
225
225
|
expect(payload).toEqual(data);
|
|
226
226
|
});
|
|
227
227
|
it("should stringify null payload", async () => {
|
|
228
228
|
const data = null;
|
|
229
|
-
const payload = client.adapter.unstable_payloadMapper(data
|
|
229
|
+
const payload = client.adapter.unstable_payloadMapper(data);
|
|
230
230
|
|
|
231
231
|
expect(payload).toEqual(JSON.stringify(data));
|
|
232
232
|
});
|
|
233
233
|
it("should not stringify undefined payload", async () => {
|
|
234
|
-
|
|
234
|
+
// oxlint-disable-next-line unicorn/no-useless-undefined
|
|
235
|
+
const payload = client.adapter.unstable_payloadMapper(undefined);
|
|
235
236
|
|
|
236
237
|
expect(payload).toBeUndefined();
|
|
237
238
|
});
|
|
@@ -239,7 +240,7 @@ describe("Client [ Utils ]", () => {
|
|
|
239
240
|
const data: Record<string, unknown> = {};
|
|
240
241
|
data.a = { b: data };
|
|
241
242
|
|
|
242
|
-
const payload = client.adapter.unstable_payloadMapper(data
|
|
243
|
+
const payload = client.adapter.unstable_payloadMapper(data);
|
|
243
244
|
expect(payload).toBe("");
|
|
244
245
|
});
|
|
245
246
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createHttpMockingServer } from "@hyper-fetch/testing";
|
|
2
|
-
|
|
3
|
-
import type { QueueDataType } from "dispatcher";
|
|
4
|
-
import { createDispatcher } from "../../utils";
|
|
5
2
|
import { Client } from "client";
|
|
3
|
+
import type { QueueDataType } from "dispatcher";
|
|
6
4
|
import { Plugin } from "plugin";
|
|
7
5
|
|
|
6
|
+
import { createDispatcher } from "../../utils";
|
|
7
|
+
|
|
8
8
|
const { resetMocks, startServer, stopServer } = createHttpMockingServer();
|
|
9
9
|
|
|
10
10
|
describe("Dispatcher [ Basic ]", () => {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { waitFor } from "@testing-library/dom";
|
|
2
1
|
import { createHttpMockingServer, sleep } from "@hyper-fetch/testing";
|
|
3
|
-
|
|
2
|
+
import { waitFor } from "@testing-library/dom";
|
|
3
|
+
import { Client } from "client";
|
|
4
4
|
import type { QueueDataType } from "dispatcher";
|
|
5
5
|
import { Dispatcher } from "dispatcher";
|
|
6
|
-
import { Client } from "client";
|
|
7
6
|
|
|
8
7
|
const { resetMocks, startServer, stopServer, mockRequest } = createHttpMockingServer();
|
|
9
8
|
|
|
@@ -26,7 +25,7 @@ const createSerializingStorage = () => {
|
|
|
26
25
|
const value = store.get(key);
|
|
27
26
|
return value ? JSON.parse(value) : undefined;
|
|
28
27
|
},
|
|
29
|
-
keys: () =>
|
|
28
|
+
keys: () => [...store.keys()],
|
|
30
29
|
entries: () => {
|
|
31
30
|
return Array.from(
|
|
32
31
|
store.entries(),
|
|
@@ -93,7 +92,7 @@ describe("Dispatcher [ Custom Serializing Storage - Issue #125 ]", () => {
|
|
|
93
92
|
});
|
|
94
93
|
|
|
95
94
|
it("should handle multiple concurrent requests with serializing storage", async () => {
|
|
96
|
-
const request = client.createRequest()({ endpoint: "shared-base-endpoint" });
|
|
95
|
+
const request = client.createRequest()({ endpoint: "shared-base-endpoint", deduplicate: false });
|
|
97
96
|
mockRequest(request);
|
|
98
97
|
|
|
99
98
|
const fetchSpy = vi.spyOn(client.adapter, "fetch");
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { waitFor } from "@testing-library/dom";
|
|
2
1
|
import { createHttpMockingServer, sleep } from "@hyper-fetch/testing";
|
|
3
|
-
|
|
2
|
+
import { waitFor } from "@testing-library/dom";
|
|
4
3
|
import type { AdapterInstance, ResponseType } from "adapter";
|
|
5
4
|
import { getErrorMessage } from "adapter";
|
|
6
|
-
import type { ResponseDetailsType } from "managers";
|
|
7
|
-
import { createDispatcher, createAdapter } from "../../utils";
|
|
8
5
|
import { Client } from "client";
|
|
9
6
|
import { xhrExtra } from "http-adapter";
|
|
7
|
+
import type { ResponseDetailsType } from "managers";
|
|
8
|
+
|
|
9
|
+
import { createDispatcher, createAdapter } from "../../utils";
|
|
10
10
|
|
|
11
11
|
const { resetMocks, startServer, stopServer, mockRequest } = createHttpMockingServer();
|
|
12
12
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { waitFor } from "@testing-library/dom";
|
|
2
1
|
import { createHttpMockingServer, sleep } from "@hyper-fetch/testing";
|
|
3
|
-
|
|
4
|
-
import { Dispatcher } from "dispatcher";
|
|
5
|
-
import { createDispatcher, createAdapter } from "../../utils";
|
|
2
|
+
import { waitFor } from "@testing-library/dom";
|
|
6
3
|
import { Client } from "client";
|
|
4
|
+
import { Dispatcher } from "dispatcher";
|
|
7
5
|
import { Plugin } from "plugin";
|
|
8
6
|
|
|
7
|
+
import { createDispatcher, createAdapter } from "../../utils";
|
|
8
|
+
|
|
9
9
|
const { resetMocks, startServer, stopServer, mockRequest } = createHttpMockingServer();
|
|
10
10
|
|
|
11
11
|
describe("Dispatcher [ Queue ]", () => {
|
|
@@ -87,7 +87,7 @@ describe("Dispatcher [ Queue ]", () => {
|
|
|
87
87
|
expect(dispatcher.getAllRunningRequests()).toHaveLength(1);
|
|
88
88
|
});
|
|
89
89
|
it("should send all concurrent requests", async () => {
|
|
90
|
-
const request = client.createRequest()({ endpoint: "shared-base-endpoint", queued: false });
|
|
90
|
+
const request = client.createRequest()({ endpoint: "shared-base-endpoint", queued: false, deduplicate: false });
|
|
91
91
|
mockRequest(request);
|
|
92
92
|
|
|
93
93
|
const spy = vi.spyOn(dispatcher, "performRequest");
|
|
@@ -99,7 +99,7 @@ describe("Dispatcher [ Queue ]", () => {
|
|
|
99
99
|
expect(dispatcher.getAllRunningRequests()).toHaveLength(2);
|
|
100
100
|
});
|
|
101
101
|
it("should send all concurrent requests without any duplicates", async () => {
|
|
102
|
-
const request = client.createRequest()({ endpoint: "shared-base-endpoint", queued: false });
|
|
102
|
+
const request = client.createRequest()({ endpoint: "shared-base-endpoint", queued: false, deduplicate: false });
|
|
103
103
|
mockRequest(request, { delay: 40 });
|
|
104
104
|
|
|
105
105
|
const spy1 = vi.spyOn(dispatcher, "performRequest");
|
|
@@ -235,8 +235,8 @@ describe("Dispatcher [ Queue ]", () => {
|
|
|
235
235
|
});
|
|
236
236
|
describe("When flushing requests", () => {
|
|
237
237
|
it("should flush all queues request", async () => {
|
|
238
|
-
const firstRequest = client.createRequest()({ endpoint: "shared-base-endpoint", queryKey: "1" });
|
|
239
|
-
const secondRequest = client.createRequest()({ endpoint: "shared-base-endpoint", queryKey: "2" });
|
|
238
|
+
const firstRequest = client.createRequest()({ endpoint: "shared-base-endpoint", queryKey: "1", deduplicate: false });
|
|
239
|
+
const secondRequest = client.createRequest()({ endpoint: "shared-base-endpoint", queryKey: "2", deduplicate: false });
|
|
240
240
|
mockRequest(firstRequest);
|
|
241
241
|
mockRequest(secondRequest);
|
|
242
242
|
|
|
@@ -307,7 +307,7 @@ describe("Dispatcher [ Queue ]", () => {
|
|
|
307
307
|
expect(spy).toHaveBeenCalledTimes(0);
|
|
308
308
|
});
|
|
309
309
|
it("should not duplicate ongoing requests using flushQueue", async () => {
|
|
310
|
-
const request = client.createRequest()({ endpoint: "shared-base-endpoint" });
|
|
310
|
+
const request = client.createRequest()({ endpoint: "shared-base-endpoint", deduplicate: false });
|
|
311
311
|
mockRequest(request, { delay: 30 });
|
|
312
312
|
|
|
313
313
|
const spy = vi.spyOn(dispatcher, "performRequest");
|
|
@@ -334,7 +334,7 @@ describe("Dispatcher [ Queue ]", () => {
|
|
|
334
334
|
});
|
|
335
335
|
describe("When starting and stopping queue", () => {
|
|
336
336
|
it("should stop queue from being send", async () => {
|
|
337
|
-
const request = client.createRequest()({ endpoint: "shared-base-endpoint", queryKey: "1" });
|
|
337
|
+
const request = client.createRequest()({ endpoint: "shared-base-endpoint", queryKey: "1", deduplicate: false });
|
|
338
338
|
mockRequest(request);
|
|
339
339
|
|
|
340
340
|
const spy = vi.spyOn(client.adapter, "fetch");
|
|
@@ -348,7 +348,7 @@ describe("Dispatcher [ Queue ]", () => {
|
|
|
348
348
|
});
|
|
349
349
|
});
|
|
350
350
|
it("should stop queue and cancel ongoing requests", async () => {
|
|
351
|
-
const request = client.createRequest()({ endpoint: "shared-base-endpoint", queryKey: "1" });
|
|
351
|
+
const request = client.createRequest()({ endpoint: "shared-base-endpoint", queryKey: "1", deduplicate: false });
|
|
352
352
|
mockRequest(request);
|
|
353
353
|
|
|
354
354
|
const spy = vi.spyOn(client.adapter, "fetch");
|
|
@@ -372,7 +372,7 @@ describe("Dispatcher [ Queue ]", () => {
|
|
|
372
372
|
});
|
|
373
373
|
});
|
|
374
374
|
it("should start previously stopped queue", async () => {
|
|
375
|
-
const request = client.createRequest()({ endpoint: "shared-base-endpoint", queryKey: "1" });
|
|
375
|
+
const request = client.createRequest()({ endpoint: "shared-base-endpoint", queryKey: "1", deduplicate: false });
|
|
376
376
|
mockRequest(request);
|
|
377
377
|
|
|
378
378
|
const spy = vi.spyOn(client.adapter, "fetch");
|
|
@@ -387,7 +387,7 @@ describe("Dispatcher [ Queue ]", () => {
|
|
|
387
387
|
});
|
|
388
388
|
});
|
|
389
389
|
it("should pause queue and finish ongoing requests", async () => {
|
|
390
|
-
const request = client.createRequest()({ endpoint: "shared-base-endpoint", queryKey: "1" });
|
|
390
|
+
const request = client.createRequest()({ endpoint: "shared-base-endpoint", queryKey: "1", deduplicate: false });
|
|
391
391
|
mockRequest(request);
|
|
392
392
|
|
|
393
393
|
const spy = vi.spyOn(client.adapter, "fetch");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { waitFor } from "@testing-library/dom";
|
|
2
1
|
import { createHttpMockingServer, sleep } from "@hyper-fetch/testing";
|
|
2
|
+
import { waitFor } from "@testing-library/dom";
|
|
3
|
+
import { Client } from "client";
|
|
3
4
|
|
|
4
5
|
import { createDispatcher, createAdapter } from "../../utils";
|
|
5
|
-
import { Client } from "client";
|
|
6
6
|
|
|
7
7
|
const { resetMocks, startServer, stopServer, mockRequest } = createHttpMockingServer();
|
|
8
8
|
|
|
@@ -90,8 +90,8 @@ describe("Dispatcher [ Requests ]", () => {
|
|
|
90
90
|
const firstSpy = vi.fn();
|
|
91
91
|
const secondSpy = vi.fn();
|
|
92
92
|
const thirdSpy = vi.fn();
|
|
93
|
-
const firstRequest = client.createRequest()({ endpoint: "shared-base-endpoint" });
|
|
94
|
-
const secondRequest = client.createRequest()({ endpoint: "shared-base-endpoint" });
|
|
93
|
+
const firstRequest = client.createRequest()({ endpoint: "shared-base-endpoint", deduplicate: false });
|
|
94
|
+
const secondRequest = client.createRequest()({ endpoint: "shared-base-endpoint", deduplicate: false });
|
|
95
95
|
mockRequest(firstRequest, { delay: 5 });
|
|
96
96
|
mockRequest(secondRequest, { delay: 5 });
|
|
97
97
|
|
|
@@ -114,8 +114,8 @@ describe("Dispatcher [ Requests ]", () => {
|
|
|
114
114
|
it("should allow to cancel single running requests", async () => {
|
|
115
115
|
const firstSpy = vi.fn();
|
|
116
116
|
const secondSpy = vi.fn();
|
|
117
|
-
const firstRequest = client.createRequest()({ endpoint: "shared-base-endpoint" });
|
|
118
|
-
const secondRequest = client.createRequest()({ endpoint: "shared-base-endpoint" });
|
|
117
|
+
const firstRequest = client.createRequest()({ endpoint: "shared-base-endpoint", deduplicate: false });
|
|
118
|
+
const secondRequest = client.createRequest()({ endpoint: "shared-base-endpoint", deduplicate: false });
|
|
119
119
|
mockRequest(firstRequest, { delay: 5 });
|
|
120
120
|
mockRequest(secondRequest, { delay: 5 });
|
|
121
121
|
|
|
@@ -136,8 +136,8 @@ describe("Dispatcher [ Requests ]", () => {
|
|
|
136
136
|
const firstSpy = vi.fn();
|
|
137
137
|
const secondSpy = vi.fn();
|
|
138
138
|
const thirdSpy = vi.fn();
|
|
139
|
-
const firstRequest = client.createRequest()({ endpoint: "shared-base-endpoint" });
|
|
140
|
-
const secondRequest = client.createRequest()({ endpoint: "shared-base-endpoint" });
|
|
139
|
+
const firstRequest = client.createRequest()({ endpoint: "shared-base-endpoint", deduplicate: false });
|
|
140
|
+
const secondRequest = client.createRequest()({ endpoint: "shared-base-endpoint", deduplicate: false });
|
|
141
141
|
mockRequest(firstRequest, { delay: 5 });
|
|
142
142
|
mockRequest(secondRequest, { delay: 5 });
|
|
143
143
|
|
|
@@ -161,8 +161,8 @@ describe("Dispatcher [ Requests ]", () => {
|
|
|
161
161
|
const firstSpy = vi.fn();
|
|
162
162
|
const secondSpy = vi.fn();
|
|
163
163
|
const thirdSpy = vi.fn();
|
|
164
|
-
const firstRequest = client.createRequest()({ endpoint: "shared-base-endpoint" });
|
|
165
|
-
const secondRequest = client.createRequest()({ endpoint: "shared-base-endpoint" });
|
|
164
|
+
const firstRequest = client.createRequest()({ endpoint: "shared-base-endpoint", deduplicate: false });
|
|
165
|
+
const secondRequest = client.createRequest()({ endpoint: "shared-base-endpoint", deduplicate: false });
|
|
166
166
|
mockRequest(firstRequest, { delay: 5 });
|
|
167
167
|
mockRequest(secondRequest, { delay: 5 });
|
|
168
168
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHttpMockingServer } from "@hyper-fetch/testing";
|
|
2
|
-
|
|
2
|
+
import { Client } from "client";
|
|
3
3
|
import type { ResolvedQueueItemType } from "dispatcher";
|
|
4
4
|
import {
|
|
5
5
|
canRetryRequest,
|
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
getIsEqualTimestamp,
|
|
11
11
|
getRequestType,
|
|
12
12
|
} from "dispatcher";
|
|
13
|
+
|
|
13
14
|
import { createDispatcher, createAdapter } from "../../utils";
|
|
14
|
-
import { Client } from "client";
|
|
15
15
|
|
|
16
16
|
const { resetMocks, startServer, stopServer, mockRequest } = createHttpMockingServer();
|
|
17
17
|
|
|
@@ -80,13 +80,13 @@ describe("Dispatcher [ Utils ]", () => {
|
|
|
80
80
|
});
|
|
81
81
|
describe("When using getIsEqualTimestamp util", () => {
|
|
82
82
|
it("should return true when timestamps are equal", async () => {
|
|
83
|
-
expect(getIsEqualTimestamp(
|
|
84
|
-
expect(getIsEqualTimestamp(
|
|
83
|
+
expect(getIsEqualTimestamp(Date.now(), 0, Date.now())).toBeTrue();
|
|
84
|
+
expect(getIsEqualTimestamp(Date.now(), 10, Date.now() + 5)).toBeTrue();
|
|
85
85
|
});
|
|
86
86
|
it("should return false when timestamps aren't equal", async () => {
|
|
87
|
-
expect(getIsEqualTimestamp(
|
|
88
|
-
expect(getIsEqualTimestamp(
|
|
89
|
-
expect(getIsEqualTimestamp(
|
|
87
|
+
expect(getIsEqualTimestamp(Date.now(), 0, Date.now() + 5)).toBeFalse();
|
|
88
|
+
expect(getIsEqualTimestamp(Date.now(), 10, Date.now() + 15)).toBeFalse();
|
|
89
|
+
expect(getIsEqualTimestamp(Date.now(), 10)).toBeFalse();
|
|
90
90
|
});
|
|
91
91
|
});
|
|
92
92
|
describe("When using canRetryRequest util", () => {
|
|
@@ -134,7 +134,34 @@ describe("Dispatcher [ Utils ]", () => {
|
|
|
134
134
|
.createRequest()({ endpoint: "shared-base-endpoint", deduplicate: true })
|
|
135
135
|
.setDeduplicateTime(1);
|
|
136
136
|
const duplicated: ResolvedQueueItemType<typeof request> = dispatcher.createStorageItem(request);
|
|
137
|
-
duplicated.timestamp =
|
|
137
|
+
duplicated.timestamp = Date.now() - 1000;
|
|
138
|
+
const type = getRequestType(request, duplicated);
|
|
139
|
+
expect(type).toBe(DispatcherMode.ALL_AT_ONCE);
|
|
140
|
+
});
|
|
141
|
+
it("should not deduplicate onto a resolved queue item", async () => {
|
|
142
|
+
// A resolved item already emitted its response, so a late joiner would wait forever
|
|
143
|
+
const request = client.createRequest()({ endpoint: "shared-base-endpoint", deduplicate: true });
|
|
144
|
+
const duplicated: ResolvedQueueItemType<typeof request> = dispatcher.createStorageItem(request);
|
|
145
|
+
duplicated.resolved = true;
|
|
146
|
+
const type = getRequestType(request, duplicated);
|
|
147
|
+
expect(type).toBe(DispatcherMode.ALL_AT_ONCE);
|
|
148
|
+
});
|
|
149
|
+
it("should not deduplicate onto a stopped queue item", async () => {
|
|
150
|
+
// A stopped item may never fire, so a joiner would never receive a response
|
|
151
|
+
const request = client.createRequest()({ endpoint: "shared-base-endpoint", deduplicate: true });
|
|
152
|
+
const duplicated: ResolvedQueueItemType<typeof request> = dispatcher.createStorageItem(request);
|
|
153
|
+
duplicated.stopped = true;
|
|
154
|
+
const type = getRequestType(request, duplicated);
|
|
155
|
+
expect(type).toBe(DispatcherMode.ALL_AT_ONCE);
|
|
156
|
+
});
|
|
157
|
+
it("should not deduplicate a request marked as used", async () => {
|
|
158
|
+
// setUsed(true) marks intentional resends, like the auth interceptor retrying after a
|
|
159
|
+
// token refresh. Deduplicating them against the original in-flight request would
|
|
160
|
+
// deadlock: the retry would await a response blocked on its own interceptor.
|
|
161
|
+
const request = client
|
|
162
|
+
.createRequest()({ endpoint: "shared-base-endpoint", deduplicate: true })
|
|
163
|
+
.setUsed(true);
|
|
164
|
+
const duplicated: ResolvedQueueItemType<typeof request> = dispatcher.createStorageItem(request);
|
|
138
165
|
const type = getRequestType(request, duplicated);
|
|
139
166
|
expect(type).toBe(DispatcherMode.ALL_AT_ONCE);
|
|
140
167
|
});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { waitFor } from "@testing-library/dom";
|
|
2
1
|
import { createHttpMockingServer } from "@hyper-fetch/testing";
|
|
3
|
-
|
|
4
|
-
import { AppManager, appManagerInitialOptions, hasDocument, hasWindow } from "managers";
|
|
2
|
+
import { waitFor } from "@testing-library/dom";
|
|
5
3
|
import { Client } from "client";
|
|
4
|
+
import { AppManager, appManagerInitialOptions, hasDocument, hasWindow } from "managers";
|
|
6
5
|
|
|
7
6
|
const { resetMocks, startServer, stopServer } = createHttpMockingServer();
|
|
8
7
|
|