Skip to content

Commit

Permalink
web-wallet: move the main __mocks__ folder in $lib
Browse files Browse the repository at this point in the history
- removed unused operations store mock

Resolves #2849
  • Loading branch information
ascartabelli committed Jan 13, 2025
1 parent 2503ae0 commit b98c315
Show file tree
Hide file tree
Showing 15 changed files with 12 additions and 17 deletions.
5 changes: 0 additions & 5 deletions web-wallet/src/__mocks__/mockedOperationsStore.js

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { cleanup, render } from "@testing-library/svelte";
import { get } from "svelte/store";

import mockedWalletStore from "../../../__mocks__/mockedWalletStore";
import mockedWalletStore from "$lib/__mocks__/mockedWalletStore";

import { AddressPicker } from "..";

Expand Down
2 changes: 1 addition & 1 deletion web-wallet/src/lib/wallet-treasury/__tests__/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from "vitest";
import { mapWith, pluckFrom } from "lamb";

import mockedWalletStore from "../../../__mocks__/mockedWalletStore";
import mockedWalletStore from "$lib/__mocks__/mockedWalletStore";

import { cachePendingNotesInfo } from "$lib/mock-data";
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { get } from "svelte/store";
import { apiMarketData } from "$lib/mock-data";
import { createCurrencyFormatter, luxToDusk } from "$lib/dusk/currency";

import mockedWalletStore from "../../../../__mocks__/mockedWalletStore";
import mockedWalletStore from "$lib/__mocks__/mockedWalletStore";

import Layout from "../+layout.svelte";
import { load } from "../+layout.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { afterAll, afterEach, describe, expect, it, vi } from "vitest";
import { cleanup } from "@testing-library/svelte";
import { renderWithSimpleContent } from "$lib/dusk/test-helpers";
import mockedWalletStore from "../../../../__mocks__/mockedWalletStore";
import mockedWalletStore from "$lib/__mocks__/mockedWalletStore";
import { stakeInfo, transactions } from "$lib/mock-data";

import Dashboard from "../+page.svelte";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { afterAll, afterEach, describe, expect, it, vi } from "vitest";
import { cleanup, fireEvent, render } from "@testing-library/svelte";
import { get } from "svelte/store";

import mockedWalletStore from "../../../../../__mocks__/mockedWalletStore";
import mockedWalletStore from "$lib/__mocks__/mockedWalletStore";

import { walletStore } from "$lib/stores";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { afterAll, afterEach, describe, expect, it, vi } from "vitest";
import { cleanup, fireEvent, render } from "@testing-library/svelte";

import mockedWalletStore from "../../../../../__mocks__/mockedWalletStore";
import mockedWalletStore from "$lib/__mocks__/mockedWalletStore";
import { createCurrencyFormatter, luxToDusk } from "$lib/dusk/currency";

import SendPage from "../+page.svelte";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { act, cleanup, fireEvent, render } from "@testing-library/svelte";
import { get } from "svelte/store";

import mockedWalletStore from "../../../../__mocks__/mockedWalletStore";
import mockedWalletStore from "$lib/__mocks__/mockedWalletStore";
import * as navigation from "$lib/navigation";
import {
gasStore,
Expand Down
10 changes: 5 additions & 5 deletions web-wallet/vite-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@ import { IntersectionObserver } from "./src/lib/dusk/mocks";
vi.mock("@reown/appkit");

vi.mock("./src/lib/vendor/w3sper.js/src/protocol-driver/mod", async () => ({
...(await import("./src/__mocks__/ProtocolDriver.js")),
...(await import("$lib/__mocks__/ProtocolDriver.js")),
}));

vi.mock(
"./src/lib/vendor/w3sper.js/src/network/components/transactions",
async (importOriginal) => ({
...(await importOriginal()),
Transactions: (await import("./src/__mocks__/Transactions.js")).default,
Transactions: (await import("$lib/__mocks__/Transactions.js")).default,
})
);

vi.mock("./src/lib/vendor/w3sper.js/src/mod", async (importOriginal) => ({
...(await importOriginal()),
AccountSyncer: (await import("./src/__mocks__/AccountSyncer.js")).default,
AddressSyncer: (await import("./src/__mocks__/AddressSyncer.js")).default,
Network: (await import("./src/__mocks__/Network.js")).default,
AccountSyncer: (await import("$lib/__mocks__/AccountSyncer")).default,
AddressSyncer: (await import("$lib/__mocks__/AddressSyncer")).default,
Network: (await import("$lib/__mocks__/Network")).default,
}));

// Removing the console logging created by the walletConnect library after each test file
Expand Down

0 comments on commit b98c315

Please sign in to comment.