feat: add morpho hooks to Earn component #7796
Annotations
10 errors
src/earn/components/DepositBalance.test.tsx > DepositBalance > renders the converted balance and subtitle correctly:
src/earn/components/DepositBalance.test.tsx#L29
TestingLibraryElementError: Unable to find an element with the text: 1000 USDC. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.
Ignored nodes: comments, script, style
<body>
<div>
<div
class="ock-bg-alternate ock-border-radius flex items-center justify-between gap-4 p-3 px-4 test-class"
data-testid="ockEarnBalance"
>
<div
class="flex flex-col ock-text-foreground"
>
<div
class="ock-font-family font-semibold"
>
1000. USDC
</div>
<div
class="ock-font-family text-sm ock-text-foreground-muted"
>
Available to deposit
</div>
</div>
<button
aria-label="Use max"
class="ock-font-family text-sm ock-text-primary"
type="button"
>
Use max
</button>
</div>
</div>
</body>
❯ Object.getElementError node_modules/@testing-library/react/node_modules/@testing-library/dom/dist/config.js:37:19
❯ node_modules/@testing-library/react/node_modules/@testing-library/dom/dist/query-helpers.js:76:38
❯ node_modules/@testing-library/react/node_modules/@testing-library/dom/dist/query-helpers.js:52:17
❯ node_modules/@testing-library/react/node_modules/@testing-library/dom/dist/query-helpers.js:95:19
❯ src/earn/components/DepositBalance.test.tsx:29:19
|
src/earn/components/DepositButton.test.tsx > DepositButton Component > renders Transaction with depositCalls from EarnProvider:
src/wallet/components/ConnectWallet.tsx#L41
TypeError: Cannot destructure property 'address' of 'useAccount(...)' as it is undefined.
❯ ConnectWallet src/wallet/components/ConnectWallet.tsx:41:20
❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:15486:18
❯ mountIndeterminateComponent node_modules/react-dom/cjs/react-dom.development.js:20103:13
❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21626:16
❯ beginWork$1 node_modules/react-dom/cjs/react-dom.development.js:27465:14
❯ performUnitOfWork node_modules/react-dom/cjs/react-dom.development.js:26599:12
❯ workLoopSync node_modules/react-dom/cjs/react-dom.development.js:26505:5
❯ renderRootSync node_modules/react-dom/cjs/react-dom.development.js:26473:7
❯ recoverFromConcurrentError node_modules/react-dom/cjs/react-dom.development.js:25889:20
❯ performConcurrentWorkOnRoot node_modules/react-dom/cjs/react-dom.development.js:25789:22
|
src/earn/components/DepositButton.test.tsx > DepositButton Component > renders TransactionButton with the correct text:
src/wallet/components/ConnectWallet.tsx#L41
TypeError: Cannot destructure property 'address' of 'useAccount(...)' as it is undefined.
❯ ConnectWallet src/wallet/components/ConnectWallet.tsx:41:20
❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:15486:18
❯ mountIndeterminateComponent node_modules/react-dom/cjs/react-dom.development.js:20103:13
❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21626:16
❯ beginWork$1 node_modules/react-dom/cjs/react-dom.development.js:27465:14
❯ performUnitOfWork node_modules/react-dom/cjs/react-dom.development.js:26599:12
❯ workLoopSync node_modules/react-dom/cjs/react-dom.development.js:26505:5
❯ renderRootSync node_modules/react-dom/cjs/react-dom.development.js:26473:7
❯ recoverFromConcurrentError node_modules/react-dom/cjs/react-dom.development.js:25889:20
❯ performConcurrentWorkOnRoot node_modules/react-dom/cjs/react-dom.development.js:25789:22
|
src/earn/components/Earn.test.tsx > Earn Component > renders custom children when provided:
src/earn/hooks/useMorphoVault.ts#L36
Error: [vitest] No "useReadContracts" export is defined on the "wagmi" mock. Did you forget to return it from "vi.mock"?
If you need to partially mock a module, you can use "importOriginal" helper inside:
vi.mock(import("wagmi"), async (importOriginal) => {
const actual = await importOriginal()
return {
...actual,
// your mocked methods
}
})
❯ Module.useMorphoVault src/earn/hooks/useMorphoVault.ts:36:28
❯ EarnProvider src/earn/components/EarnProvider.tsx:21:40
❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:15486:18
❯ mountIndeterminateComponent node_modules/react-dom/cjs/react-dom.development.js:20103:13
❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21626:16
❯ beginWork$1 node_modules/react-dom/cjs/react-dom.development.js:27465:14
❯ performUnitOfWork node_modules/react-dom/cjs/react-dom.development.js:26599:12
❯ workLoopSync node_modules/react-dom/cjs/react-dom.development.js:26505:5
|
src/earn/components/Earn.test.tsx > Earn Component > renders default tabs and their contents when children are not provided:
src/earn/hooks/useMorphoVault.ts#L36
Error: [vitest] No "useReadContracts" export is defined on the "wagmi" mock. Did you forget to return it from "vi.mock"?
If you need to partially mock a module, you can use "importOriginal" helper inside:
vi.mock(import("wagmi"), async (importOriginal) => {
const actual = await importOriginal()
return {
...actual,
// your mocked methods
}
})
❯ Module.useMorphoVault src/earn/hooks/useMorphoVault.ts:36:28
❯ EarnProvider src/earn/components/EarnProvider.tsx:21:40
❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:15486:18
❯ mountIndeterminateComponent node_modules/react-dom/cjs/react-dom.development.js:20103:13
❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21626:16
❯ beginWork$1 node_modules/react-dom/cjs/react-dom.development.js:27465:14
❯ performUnitOfWork node_modules/react-dom/cjs/react-dom.development.js:26599:12
❯ workLoopSync node_modules/react-dom/cjs/react-dom.development.js:26505:5
|
src/earn/components/EarnDeposit.test.tsx > EarnDeposit Component > renders default components when children are not provided:
src/wallet/components/ConnectWallet.tsx#L41
WagmiProviderNotFoundError: `useConfig` must be used within `WagmiProvider`.
Docs: https://wagmi.sh/react/api/WagmiProvider.html
Version: wagmi@2.14.7
❯ useConfig node_modules/wagmi/src/hooks/useConfig.ts:20:22
❯ Module.useAccount node_modules/wagmi/src/hooks/useAccount.ts:25:18
❯ ConnectWallet src/wallet/components/ConnectWallet.tsx:41:47
❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:15486:18
❯ mountIndeterminateComponent node_modules/react-dom/cjs/react-dom.development.js:20103:13
❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21626:16
❯ beginWork$1 node_modules/react-dom/cjs/react-dom.development.js:27465:14
❯ performUnitOfWork node_modules/react-dom/cjs/react-dom.development.js:26599:12
❯ workLoopSync node_modules/react-dom/cjs/react-dom.development.js:26505:5
❯ renderRootSync node_modules/react-dom/cjs/react-dom.development.js:26473:7
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { details: undefined, docsPath: '/api/WagmiProvider', metaMessages: undefined, shortMessage: '`useConfig` must be used within `WagmiProvider`.', docsBaseUrl: 'https://wagmi.sh/react', version: 'wagmi@2.14.7', walk: 'Function<walk>' }
|
src/earn/components/EarnDeposit.test.tsx > EarnDeposit Component > applies custom className to the EarnCard:
src/wallet/components/ConnectWallet.tsx#L41
WagmiProviderNotFoundError: `useConfig` must be used within `WagmiProvider`.
Docs: https://wagmi.sh/react/api/WagmiProvider.html
Version: wagmi@2.14.7
❯ useConfig node_modules/wagmi/src/hooks/useConfig.ts:20:22
❯ Module.useAccount node_modules/wagmi/src/hooks/useAccount.ts:25:18
❯ ConnectWallet src/wallet/components/ConnectWallet.tsx:41:47
❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:15486:18
❯ mountIndeterminateComponent node_modules/react-dom/cjs/react-dom.development.js:20103:13
❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21626:16
❯ beginWork$1 node_modules/react-dom/cjs/react-dom.development.js:27465:14
❯ performUnitOfWork node_modules/react-dom/cjs/react-dom.development.js:26599:12
❯ workLoopSync node_modules/react-dom/cjs/react-dom.development.js:26505:5
❯ renderRootSync node_modules/react-dom/cjs/react-dom.development.js:26473:7
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { details: undefined, docsPath: '/api/WagmiProvider', metaMessages: undefined, shortMessage: '`useConfig` must be used within `WagmiProvider`.', docsBaseUrl: 'https://wagmi.sh/react', version: 'wagmi@2.14.7', walk: 'Function<walk>' }
|
src/earn/components/EarnProvider.test.tsx > EarnProvider > provides vault address through context:
src/earn/hooks/useMorphoVault.ts#L36
WagmiProviderNotFoundError: `useConfig` must be used within `WagmiProvider`.
Docs: https://wagmi.sh/react/api/WagmiProvider.html
Version: wagmi@2.14.7
❯ useConfig node_modules/wagmi/src/hooks/useConfig.ts:20:22
❯ Proxy.useReadContracts node_modules/wagmi/src/hooks/useReadContracts.ts:63:18
❯ Module.useMorphoVault src/earn/hooks/useMorphoVault.ts:36:28
❯ EarnProvider src/earn/components/EarnProvider.tsx:21:40
❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:15486:18
❯ mountIndeterminateComponent node_modules/react-dom/cjs/react-dom.development.js:20103:13
❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21626:16
❯ beginWork$1 node_modules/react-dom/cjs/react-dom.development.js:27465:14
❯ performUnitOfWork node_modules/react-dom/cjs/react-dom.development.js:26599:12
❯ workLoopSync node_modules/react-dom/cjs/react-dom.development.js:26505:5
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { details: undefined, docsPath: '/api/WagmiProvider', metaMessages: undefined, shortMessage: '`useConfig` must be used within `WagmiProvider`.', docsBaseUrl: 'https://wagmi.sh/react', version: 'wagmi@2.14.7', walk: 'Function<walk>' }
|
src/earn/components/EarnWithdraw.test.tsx > EarnWithdraw Component > renders default components when children are not provided:
src/wallet/components/ConnectWallet.tsx#L41
WagmiProviderNotFoundError: `useConfig` must be used within `WagmiProvider`.
Docs: https://wagmi.sh/react/api/WagmiProvider.html
Version: wagmi@2.14.7
❯ useConfig node_modules/wagmi/src/hooks/useConfig.ts:20:22
❯ Module.useAccount node_modules/wagmi/src/hooks/useAccount.ts:25:18
❯ ConnectWallet src/wallet/components/ConnectWallet.tsx:41:47
❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:15486:18
❯ mountIndeterminateComponent node_modules/react-dom/cjs/react-dom.development.js:20103:13
❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21626:16
❯ beginWork$1 node_modules/react-dom/cjs/react-dom.development.js:27465:14
❯ performUnitOfWork node_modules/react-dom/cjs/react-dom.development.js:26599:12
❯ workLoopSync node_modules/react-dom/cjs/react-dom.development.js:26505:5
❯ renderRootSync node_modules/react-dom/cjs/react-dom.development.js:26473:7
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { details: undefined, docsPath: '/api/WagmiProvider', metaMessages: undefined, shortMessage: '`useConfig` must be used within `WagmiProvider`.', docsBaseUrl: 'https://wagmi.sh/react', version: 'wagmi@2.14.7', walk: 'Function<walk>' }
|
src/earn/components/EarnWithdraw.test.tsx > EarnWithdraw Component > applies custom className to the EarnCard:
src/wallet/components/ConnectWallet.tsx#L41
WagmiProviderNotFoundError: `useConfig` must be used within `WagmiProvider`.
Docs: https://wagmi.sh/react/api/WagmiProvider.html
Version: wagmi@2.14.7
❯ useConfig node_modules/wagmi/src/hooks/useConfig.ts:20:22
❯ Module.useAccount node_modules/wagmi/src/hooks/useAccount.ts:25:18
❯ ConnectWallet src/wallet/components/ConnectWallet.tsx:41:47
❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:15486:18
❯ mountIndeterminateComponent node_modules/react-dom/cjs/react-dom.development.js:20103:13
❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21626:16
❯ beginWork$1 node_modules/react-dom/cjs/react-dom.development.js:27465:14
❯ performUnitOfWork node_modules/react-dom/cjs/react-dom.development.js:26599:12
❯ workLoopSync node_modules/react-dom/cjs/react-dom.development.js:26505:5
❯ renderRootSync node_modules/react-dom/cjs/react-dom.development.js:26473:7
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { details: undefined, docsPath: '/api/WagmiProvider', metaMessages: undefined, shortMessage: '`useConfig` must be used within `WagmiProvider`.', docsBaseUrl: 'https://wagmi.sh/react', version: 'wagmi@2.14.7', walk: 'Function<walk>' }
|