aboutsummaryrefslogtreecommitdiff
path: root/packages/web-util/src/tests/swr.ts
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-01-02 15:11:28 -0300
committerSebastian <sebasjm@gmail.com>2023-01-03 01:58:17 -0300
commitd1aa79eae817b1cf4c23f800308ecad101692ac7 (patch)
tree32282462d6dc6116ffe627159286f31a1494c7b1 /packages/web-util/src/tests/swr.ts
parentd48ea17c6345abaa732deb5fab6141449d463e41 (diff)
downloadwallet-core-d1aa79eae817b1cf4c23f800308ecad101692ac7.tar.xz
remove axios, better api
Diffstat (limited to 'packages/web-util/src/tests/swr.ts')
-rw-r--r--packages/web-util/src/tests/swr.ts12
1 files changed, 4 insertions, 8 deletions
diff --git a/packages/web-util/src/tests/swr.ts b/packages/web-util/src/tests/swr.ts
index 95c62ebea..62a35f83d 100644
--- a/packages/web-util/src/tests/swr.ts
+++ b/packages/web-util/src/tests/swr.ts
@@ -15,10 +15,9 @@
*/
import { ComponentChildren, FunctionalComponent, h, VNode } from "preact";
-import { MockEnvironment, Query } from "./mock.js";
+import { MockEnvironment } from "./mock.js";
import { SWRConfig } from "swr";
-export { Query };
/**
* Helper for hook that use SWR inside.
*
@@ -30,14 +29,10 @@ export class SwrMockEnvironment extends MockEnvironment {
super(debug);
}
- mockApiIfNeeded(): void {
- null; // do nothing
- }
-
public buildTestingContext(): FunctionalComponent<{
children: ComponentChildren;
}> {
- const __REGISTER_REQUEST = this.registerRequest.bind(this);
+ const __SAVE_REQUEST_AND_GET_MOCKED_RESPONSE = this.saveRequestAndGetMockedResponse.bind(this);
return function TestingContext({
children,
}: {
@@ -47,8 +42,9 @@ export class SwrMockEnvironment extends MockEnvironment {
SWRConfig,
{
value: {
+ // eslint-disable-next-line @typescript-eslint/ban-types
fetcher: (url: string, options: object) => {
- const mocked = __REGISTER_REQUEST(
+ const mocked = __SAVE_REQUEST_AND_GET_MOCKED_RESPONSE(
{
method: "get",
url,