From c6cffda89c61e677f54a15788f0a2b80f2750bac Mon Sep 17 00:00:00 2001 From: Hayden Shively Date: Tue, 25 Nov 2025 15:59:37 -0600 Subject: [PATCH 1/3] fix(tests): click soneium instead of OP and update polygon fork --- apps/lite/test/app/dashboard/page.test.tsx | 26 ++++++------ apps/lite/test/config.ts | 7 ++-- package.json | 2 +- pnpm-lock.yaml | 49 ++++++++++------------ 4 files changed, 41 insertions(+), 43 deletions(-) diff --git a/apps/lite/test/app/dashboard/page.test.tsx b/apps/lite/test/app/dashboard/page.test.tsx index 44ff602..98629e5 100644 --- a/apps/lite/test/app/dashboard/page.test.tsx +++ b/apps/lite/test/app/dashboard/page.test.tsx @@ -2,7 +2,7 @@ import { abbreviateAddress } from "@morpho-org/uikit/lib/utils"; import userEvent from "@testing-library/user-event"; import { http, UserRejectedRequestError } from "viem"; import { generatePrivateKey, privateKeyToAddress } from "viem/accounts"; -import { mainnet, base, optimism } from "viem/chains"; +import { mainnet, base, soneium } from "viem/chains"; import { describe, expect, vi } from "vitest"; import { mock } from "wagmi"; @@ -68,13 +68,13 @@ describe("connect wallet flow", () => { }); describe("switch chain flow", () => { - testWithMainnetFork("switches to optimism without wallet and opens main app", async ({ client }) => { + testWithMainnetFork("switches to soneium without wallet and opens main app", async ({ client }) => { const account = privateKeyToAddress(generatePrivateKey()); const wagmiConfig = createConfig({ - chains: [mainnet, optimism], + chains: [mainnet, soneium], transports: { [mainnet.id]: http(client.transport.url), - [optimism.id]: http(rpcUrls[optimism.id]), + [soneium.id]: http(rpcUrls[soneium.id]), }, connectors: [mock({ accounts: [account] })], }); @@ -82,24 +82,24 @@ describe("switch chain flow", () => { window.localStorage.setItem("hasSeenWelcome", "true"); render(, { wagmiConfig, - routes: [{ element:
Switched to Optimism successfully!
, path: "op-mainnet/earn" }], + routes: [{ element:
Switched to Soneium successfully!
, path: "soneium-mainnet/earn" }], }); window.open = vi.fn(); await userEvent.click(screen.getByRole("combobox")); - await userEvent.click(screen.getByText("OP Mainnet")); + await userEvent.click(screen.getByText("Soneium Mainnet")); - expect(screen.getByText("Switched to Optimism successfully!")).toBeInTheDocument(); + expect(screen.getByText("Switched to Soneium successfully!")).toBeInTheDocument(); }); - testWithMainnetFork("switches to optimism with wallet", async ({ client }) => { + testWithMainnetFork("switches to soneium with wallet", async ({ client }) => { const account = privateKeyToAddress(generatePrivateKey()); const wagmiConfig = createConfig({ - chains: [mainnet, optimism], + chains: [mainnet, soneium], transports: { [mainnet.id]: http(client.transport.url), - [optimism.id]: http(rpcUrls[optimism.id]), + [soneium.id]: http(rpcUrls[soneium.id]), }, connectors: [mock({ accounts: [account], features: { defaultConnected: true } })], }); @@ -107,14 +107,14 @@ describe("switch chain flow", () => { window.localStorage.setItem("hasSeenWelcome", "true"); render(, { wagmiConfig, - routes: [{ element:
Switched to Optimism successfully!
, path: "op-mainnet/earn" }], + routes: [{ element:
Switched to Soneium successfully!
, path: "soneium-mainnet/earn" }], }); window.open = vi.fn(); await userEvent.click(screen.getByRole("combobox")); - await userEvent.click(screen.getByText("OP Mainnet")); + await userEvent.click(screen.getByText("Soneium Mainnet")); - expect(screen.getByText("Switched to Optimism successfully!")).toBeInTheDocument(); + expect(screen.getByText("Switched to Soneium successfully!")).toBeInTheDocument(); }); }); diff --git a/apps/lite/test/config.ts b/apps/lite/test/config.ts index ad0a6e6..1a03c4a 100644 --- a/apps/lite/test/config.ts +++ b/apps/lite/test/config.ts @@ -1,13 +1,14 @@ import { createViemTest } from "@morpho-org/test/vitest"; -import { base, mainnet, optimism, polygon } from "viem/chains"; +import { base, mainnet, optimism, polygon, soneium } from "viem/chains"; -export const chains = [mainnet, base, optimism, polygon] as const; +export const chains = [mainnet, base, optimism, polygon, soneium] as const; export const rpcUrls: { [K in (typeof chains)[number]["id"]]: `https://${string}` } = { [mainnet.id]: `https://eth-mainnet.g.alchemy.com/v2/${import.meta.env.VITE_ALCHEMY_API_KEY}`, [base.id]: `https://base-mainnet.g.alchemy.com/v2/${import.meta.env.VITE_ALCHEMY_API_KEY}`, [optimism.id]: `https://op-mainnet.g.alchemy.com/v2/${import.meta.env.VITE_ALCHEMY_API_KEY}`, [polygon.id]: `https://polygon-mainnet.g.alchemy.com/v2/${import.meta.env.VITE_ALCHEMY_API_KEY}`, + [soneium.id]: `https://soneium-mainnet.g.alchemy.com/v2/${import.meta.env.VITE_ALCHEMY_API_KEY}`, }; export const testWithMainnetFork = createViemTest(mainnet, { @@ -17,5 +18,5 @@ export const testWithMainnetFork = createViemTest(mainnet, { export const testWithPolygonFork = createViemTest(polygon, { forkUrl: rpcUrls[polygon.id], - forkBlockNumber: 70_000_000, + forkBlockNumber: 79_501_383, }); diff --git a/package.json b/package.json index 06c0d5c..5f1db98 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ }, "devDependencies": { "@eslint/js": "^9.21.0", - "@morpho-org/test": "^2.1.1", + "@morpho-org/test": "^2.6.3", "@testing-library/dom": "^10.4.0", "@testing-library/jest-dom": "^6.6.3", "@testing-library/react": "^16.3.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bca02d9..356ab75 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,8 +11,8 @@ importers: specifier: ^9.21.0 version: 9.26.0 "@morpho-org/test": - specifier: ^2.1.1 - version: 2.1.3(viem@2.29.2(bufferutil@4.0.9)(typescript@5.7.3)(utf-8-validate@5.0.10)(zod@3.24.4))(vitest@3.1.3(@types/debug@4.1.12)(@types/node@22.15.17)(jiti@2.4.2)(jsdom@26.1.0(bufferutil@4.0.9)(utf-8-validate@5.0.10))(lightningcss@1.29.2)(terser@5.39.0)(tsx@4.19.4)(yaml@2.7.1)) + specifier: ^2.6.3 + version: 2.6.3(viem@2.29.2(bufferutil@4.0.9)(typescript@5.7.3)(utf-8-validate@5.0.10)(zod@3.24.4))(vitest@3.1.3(@types/debug@4.1.12)(@types/node@22.15.17)(jiti@2.4.2)(jsdom@26.1.0(bufferutil@4.0.9)(utf-8-validate@5.0.10))(lightningcss@1.29.2)(terser@5.39.0)(tsx@4.19.4)(yaml@2.7.1)) "@testing-library/dom": specifier: ^10.4.0 version: 10.4.0 @@ -1773,19 +1773,16 @@ packages: resolution: { integrity: sha512-VBi9ntCAKEoIjVejVSB2P2Gg62QOcBw1sBfES47i/EDswBuqpTXlX1QYclP3GoD1dQaZUpLulRrajGPrHHKDhQ== } - "@morpho-org/test@2.1.3": + "@morpho-org/test@2.6.3": resolution: - { integrity: sha512-qggGhvcJZsi3X8jxl+cBeZAWEhc/2J2xXHyWu9+mRR3V3KZ4NLr15xPLRWcpoXVQLdPayCpC5E1qyQeq0GuDdg== } + { integrity: sha512-4U7M5ZWmaLG9aae6ygwfTGY6UnGHM1Jc3SIoWlVtDfo5XIoEV7zvSvyGuzwtnwJENtlaJSYtTuj3BBDOIPSxUw== } peerDependencies: "@playwright/test": ^1.48.1 - ethers: ^6.13.0 viem: ^2.21.10 vitest: ">=2.0.0 <4.0.0" peerDependenciesMeta: "@playwright/test": optional: true - ethers: - optional: true vitest: optional: true @@ -10555,9 +10552,9 @@ packages: peerDependencies: viem: ^2.21.18 - viem-tracer@1.6.0: + viem-tracer@1.8.0: resolution: - { integrity: sha512-gzEN7V0TmnfC0nQ8Z+IS+gTiOKw6hOPIMlZdn+VYBLCMLc6UDd5pUjID9nkXLF/gGvvkzey9yo2o/E9X9GMbMA== } + { integrity: sha512-4cyMux8N9v8gBLpmgtayhdPsNz7C46SNqaS2RrURKRFqEgDGvCGuRNn5I+PhDrnY/NZoLWWosUF3gOQ/r60lcA== } peerDependencies: viem: ^2.21.0 @@ -12449,7 +12446,7 @@ snapshots: "@humanwhocodes/retry@0.4.3": {} - "@inkjs/ui@2.0.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@18.3.1)(utf-8-validate@5.0.10))": + "@inkjs/ui@2.0.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@19.1.0)(utf-8-validate@5.0.10))": dependencies: chalk: 5.4.1 cli-spinners: 3.2.0 @@ -12808,12 +12805,12 @@ snapshots: "@morpho-org/morpho-ts@2.3.0": {} - "@morpho-org/test@2.1.3(viem@2.29.2(bufferutil@4.0.9)(typescript@5.7.3)(utf-8-validate@5.0.10)(zod@3.24.4))(vitest@3.1.3(@types/debug@4.1.12)(@types/node@22.15.17)(jiti@2.4.2)(jsdom@26.1.0(bufferutil@4.0.9)(utf-8-validate@5.0.10))(lightningcss@1.29.2)(terser@5.39.0)(tsx@4.19.4)(yaml@2.7.1))": + "@morpho-org/test@2.6.3(viem@2.29.2(bufferutil@4.0.9)(typescript@5.7.3)(utf-8-validate@5.0.10)(zod@3.24.4))(vitest@3.1.3(@types/debug@4.1.12)(@types/node@22.15.17)(jiti@2.4.2)(jsdom@26.1.0(bufferutil@4.0.9)(utf-8-validate@5.0.10))(lightningcss@1.29.2)(terser@5.39.0)(tsx@4.19.4)(yaml@2.7.1))": dependencies: lodash.kebabcase: 4.1.1 viem: 2.29.2(bufferutil@4.0.9)(typescript@5.7.3)(utf-8-validate@5.0.10)(zod@3.24.4) viem-deal: 2.0.4(viem@2.29.2(bufferutil@4.0.9)(typescript@5.7.3)(utf-8-validate@5.0.10)(zod@3.24.4)) - viem-tracer: 1.6.0(viem@2.29.2(bufferutil@4.0.9)(typescript@5.7.3)(utf-8-validate@5.0.10)(zod@3.24.4)) + viem-tracer: 1.8.0(viem@2.29.2(bufferutil@4.0.9)(typescript@5.7.3)(utf-8-validate@5.0.10)(zod@3.24.4)) optionalDependencies: vitest: 3.1.3(@types/debug@4.1.12)(@types/node@22.15.17)(jiti@2.4.2)(jsdom@26.1.0(bufferutil@4.0.9)(utf-8-validate@5.0.10))(lightningcss@1.29.2)(terser@5.39.0)(tsx@4.19.4)(yaml@2.7.1) @@ -15538,13 +15535,13 @@ snapshots: figures: 6.1.0 glob: 11.0.2 ink: 5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@18.3.1)(utf-8-validate@5.0.10) - ink-big-text: 2.0.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1) - ink-gradient: 3.0.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@18.3.1)(utf-8-validate@5.0.10)) - ink-select-input: 6.2.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1) - ink-spinner: 5.0.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1) - ink-text-input: 6.0.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1) + ink-big-text: 2.0.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@19.1.0)(utf-8-validate@5.0.10))(react@18.3.1) + ink-gradient: 3.0.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@19.1.0)(utf-8-validate@5.0.10)) + ink-select-input: 6.2.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@19.1.0)(utf-8-validate@5.0.10))(react@18.3.1) + ink-spinner: 5.0.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@19.1.0)(utf-8-validate@5.0.10))(react@18.3.1) + ink-text-input: 6.0.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@19.1.0)(utf-8-validate@5.0.10))(react@18.3.1) json-bigint: 1.0.0 - pastel: 3.0.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(zod@3.24.4) + pastel: 3.0.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@19.1.0)(utf-8-validate@5.0.10))(react@18.3.1)(zod@3.24.4) react: 18.3.1 solc: 0.8.30 tiny-jsonc: 1.0.2 @@ -19164,14 +19161,14 @@ snapshots: ini@2.0.0: {} - ink-big-text@2.0.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1): + ink-big-text@2.0.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@19.1.0)(utf-8-validate@5.0.10))(react@18.3.1): dependencies: cfonts: 3.3.0 ink: 5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@18.3.1)(utf-8-validate@5.0.10) prop-types: 15.8.1 react: 18.3.1 - ink-gradient@3.0.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@18.3.1)(utf-8-validate@5.0.10)): + ink-gradient@3.0.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@19.1.0)(utf-8-validate@5.0.10)): dependencies: "@types/gradient-string": 1.1.6 gradient-string: 2.0.2 @@ -19179,20 +19176,20 @@ snapshots: prop-types: 15.8.1 strip-ansi: 7.1.0 - ink-select-input@6.2.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1): + ink-select-input@6.2.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@19.1.0)(utf-8-validate@5.0.10))(react@18.3.1): dependencies: figures: 6.1.0 ink: 5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@18.3.1)(utf-8-validate@5.0.10) react: 18.3.1 to-rotated: 1.0.0 - ink-spinner@5.0.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1): + ink-spinner@5.0.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@19.1.0)(utf-8-validate@5.0.10))(react@18.3.1): dependencies: cli-spinners: 2.9.2 ink: 5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@18.3.1)(utf-8-validate@5.0.10) react: 18.3.1 - ink-text-input@6.0.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1): + ink-text-input@6.0.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@19.1.0)(utf-8-validate@5.0.10))(react@18.3.1): dependencies: chalk: 5.4.1 ink: 5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@18.3.1)(utf-8-validate@5.0.10) @@ -20133,9 +20130,9 @@ snapshots: pascalcase@0.1.1: {} - pastel@3.0.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(zod@3.24.4): + pastel@3.0.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@19.1.0)(utf-8-validate@5.0.10))(react@18.3.1)(zod@3.24.4): dependencies: - "@inkjs/ui": 2.0.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@18.3.1)(utf-8-validate@5.0.10)) + "@inkjs/ui": 2.0.0(ink@5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@19.1.0)(utf-8-validate@5.0.10)) commander: 12.1.0 decamelize: 6.0.0 ink: 5.2.1(@types/react@19.1.3)(bufferutil@4.0.9)(react@18.3.1)(utf-8-validate@5.0.10) @@ -21668,7 +21665,7 @@ snapshots: dependencies: viem: 2.29.2(bufferutil@4.0.9)(typescript@5.7.3)(utf-8-validate@5.0.10)(zod@3.24.4) - viem-tracer@1.6.0(viem@2.29.2(bufferutil@4.0.9)(typescript@5.7.3)(utf-8-validate@5.0.10)(zod@3.24.4)): + viem-tracer@1.8.0(viem@2.29.2(bufferutil@4.0.9)(typescript@5.7.3)(utf-8-validate@5.0.10)(zod@3.24.4)): dependencies: colors: 1.4.0 viem: 2.29.2(bufferutil@4.0.9)(typescript@5.7.3)(utf-8-validate@5.0.10)(zod@3.24.4) From 2ec237d5a8a5da3f72e3165eb5766a11cb1e52a5 Mon Sep 17 00:00:00 2001 From: Hayden Shively Date: Tue, 25 Nov 2025 16:01:42 -0600 Subject: [PATCH 2/3] for fallback --- apps/fallback/test/components/borrow-sheet-content.test.tsx | 2 +- apps/fallback/test/config.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/fallback/test/components/borrow-sheet-content.test.tsx b/apps/fallback/test/components/borrow-sheet-content.test.tsx index b366213..578880a 100644 --- a/apps/fallback/test/components/borrow-sheet-content.test.tsx +++ b/apps/fallback/test/components/borrow-sheet-content.test.tsx @@ -465,7 +465,7 @@ describe("repay flow", () => { expect(approval.args.owner).toBe(account); expect(approval.args.spender).toBe(morphoAddress); - expect(approval.args.value).toBe(10009997787393201n); // > 0.01 because of share growth buffer + expect(approval.args.value).toBe(10009973542199462n); // > 0.01 because of share growth buffer await waitFor(() => screen.findAllByRole("button", { name: "Repay" }), { timeout: 10_000 }); diff --git a/apps/fallback/test/config.ts b/apps/fallback/test/config.ts index 0c526cc..1f2eafb 100644 --- a/apps/fallback/test/config.ts +++ b/apps/fallback/test/config.ts @@ -17,5 +17,5 @@ export const testWithMainnetFork = createViemTest(mainnet, { export const testWithPolygonFork = createViemTest(polygon, { forkUrl: rpcUrls[polygon.id], - forkBlockNumber: 70_000_000, + forkBlockNumber: 79_501_383, }); From bca7070538c6b988d026b421daa4d81608066807 Mon Sep 17 00:00:00 2001 From: Hayden Shively Date: Tue, 25 Nov 2025 21:08:02 -0600 Subject: [PATCH 3/3] switch off alchemy --- apps/lite/test/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/lite/test/config.ts b/apps/lite/test/config.ts index 1a03c4a..36315a9 100644 --- a/apps/lite/test/config.ts +++ b/apps/lite/test/config.ts @@ -7,7 +7,7 @@ export const rpcUrls: { [K in (typeof chains)[number]["id"]]: `https://${string} [mainnet.id]: `https://eth-mainnet.g.alchemy.com/v2/${import.meta.env.VITE_ALCHEMY_API_KEY}`, [base.id]: `https://base-mainnet.g.alchemy.com/v2/${import.meta.env.VITE_ALCHEMY_API_KEY}`, [optimism.id]: `https://op-mainnet.g.alchemy.com/v2/${import.meta.env.VITE_ALCHEMY_API_KEY}`, - [polygon.id]: `https://polygon-mainnet.g.alchemy.com/v2/${import.meta.env.VITE_ALCHEMY_API_KEY}`, + [polygon.id]: `https://polygon.gateway.tenderly.co`, [soneium.id]: `https://soneium-mainnet.g.alchemy.com/v2/${import.meta.env.VITE_ALCHEMY_API_KEY}`, };