Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
OKendigelyan committed Jan 21, 2025
1 parent 0094393 commit 54dfc39
Show file tree
Hide file tree
Showing 5 changed files with 916 additions and 893 deletions.
1 change: 1 addition & 0 deletions packages/data-polling/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"@umami/state": "workspace:^",
"@umami/tezos": "workspace:^",
"@umami/tzkt": "workspace:^",
"@umami/test-utils": "workspace:^",
"date-fns": "^4.1.0",
"framer-motion": "^11.15.0",
"lodash": "^4.17.21",
Expand Down
2 changes: 2 additions & 0 deletions packages/data-polling/src/setupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import { webcrypto } from "crypto";
import { TextDecoder, TextEncoder } from "util";

import { mockToast } from "@umami/state";
import { mockLocalStorage } from "@umami/test-utils";

beforeEach(() => {
Object.defineProperties(global, {
crypto: { value: webcrypto, writable: true },
TextDecoder: { value: TextDecoder, writable: true },
TextEncoder: { value: TextEncoder, writable: true },
localStorage: { value: mockLocalStorage(), writable: true },
});
});

Expand Down
7 changes: 3 additions & 4 deletions packages/data-polling/src/testUtils.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import * as testLib from "@testing-library/react";
import { type UmamiStore, makeStore } from "@umami/state";
import { type PropsWithChildren, act } from "react";
import { Provider } from "react-redux";
import { makeStore, UmamiStore } from "@umami/state";
import { PropsWithChildren, act } from "react";

import { QueryClient, QueryClientProvider } from "@tanstack/react-query";

const customRenderHook = <
Result,
Expand Down
6 changes: 3 additions & 3 deletions packages/state/src/setupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Object.defineProperties(global, {
fetch: { value: jest.fn(), writable: true },
});

jest.mock("@chakra-ui/react", () => ({
...jest.requireActual("@chakra-ui/react"),
useToast: () => mockToast,
jest.mock("@umami/utils", () => ({
...jest.requireActual("@umami/utils"),
useCustomToast: () => mockToast,
}));

jest.mock("./beacon/WalletClient", () => ({
Expand Down
Loading

0 comments on commit 54dfc39

Please sign in to comment.