-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Wrap Cartesi logo in a link redirecting to home page (#60)
- Loading branch information
1 parent
63fda14
commit 051773c
Showing
2 changed files
with
142 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
import { render } from "@testing-library/react"; | ||
import { afterAll, describe, it } from "vitest"; | ||
import withMantineTheme from "../utils/WithMantineTheme"; | ||
import Shell from "../../src/app/shell"; | ||
|
||
const Component = withMantineTheme(Shell); | ||
|
||
vi.mock("../../src/graphql", async () => { | ||
return { | ||
useApplicationsQuery: () => [{ data: {}, fetching: false }], | ||
useTokensQuery: () => [{ data: {}, fetching: false }], | ||
}; | ||
}); | ||
|
||
vi.mock("@cartesi/rollups-wagmi", async () => { | ||
return { | ||
usePrepareInputBoxAddInput: () => ({ | ||
config: {}, | ||
}), | ||
useInputBoxAddInput: () => ({ | ||
data: {}, | ||
wait: vi.fn(), | ||
}), | ||
}; | ||
}); | ||
|
||
vi.mock("viem", async () => { | ||
const actual = await vi.importActual("viem"); | ||
return { | ||
...(actual as any), | ||
getAddress: (address: string) => address, | ||
}; | ||
}); | ||
|
||
vi.mock("@rainbow-me/rainbowkit", async () => { | ||
return { | ||
ConnectButton: () => <></>, | ||
}; | ||
}); | ||
|
||
vi.mock("@cartesi/rollups-wagmi", async () => { | ||
const actual = await vi.importActual("@cartesi/rollups-wagmi"); | ||
return { | ||
...(actual as any), | ||
usePrepareErc20Approve: () => ({ | ||
config: {}, | ||
}), | ||
useErc20Approve: () => ({ | ||
data: {}, | ||
wait: vi.fn(), | ||
}), | ||
usePrepareErc20PortalDepositErc20Tokens: () => ({ | ||
config: {}, | ||
}), | ||
useErc20PortalDepositErc20Tokens: () => ({ | ||
data: {}, | ||
wait: vi.fn(), | ||
}), | ||
usePrepareEtherPortalDepositEther: () => ({ | ||
config: {}, | ||
}), | ||
useEtherPortalDepositEther: () => ({ | ||
data: {}, | ||
wait: vi.fn(), | ||
}), | ||
}; | ||
}); | ||
|
||
vi.mock("wagmi", async () => { | ||
return { | ||
useContractReads: () => ({ | ||
isLoading: false, | ||
isSuccess: true, | ||
data: [ | ||
{ | ||
result: undefined, | ||
error: undefined, | ||
}, | ||
{ | ||
result: undefined, | ||
error: undefined, | ||
}, | ||
{ | ||
result: undefined, | ||
error: undefined, | ||
}, | ||
{ | ||
result: undefined, | ||
error: undefined, | ||
}, | ||
], | ||
}), | ||
useAccount: () => ({ | ||
address: "0x8FD78976f8955D13bAA4fC99043208F4EC020D7E", | ||
}), | ||
usePrepareContractWrite: () => ({}), | ||
useWaitForTransaction: () => ({}), | ||
useContractWrite: () => ({}), | ||
useNetwork: () => ({ | ||
chain: { | ||
nativeCurrency: { | ||
decimals: 18, | ||
}, | ||
}, | ||
}), | ||
}; | ||
}); | ||
|
||
describe("Shell component", () => { | ||
afterAll(() => { | ||
vi.restoreAllMocks(); | ||
}); | ||
|
||
describe("Cartesi logo", () => { | ||
it("should be wrapped in a anchor element with href to index route", () => { | ||
const { container } = render(<Component>Children</Component>); | ||
const logo = container.querySelector("svg") as SVGSVGElement; | ||
const logoLink = logo.closest("a") as HTMLAnchorElement; | ||
|
||
expect(logoLink.getAttribute("href")).toBe("/"); | ||
}); | ||
}); | ||
}); |
051773c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
rollups-explorer-workshop – ./apps/workshop
rollups-explorer-workshop-cartesi.vercel.app
rollups-explorer-workshop.vercel.app
rollups-explorer-workshop-git-main-cartesi.vercel.app
051773c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
rollups-explorer-sepolia – ./apps/web
rollups-explorer-sepolia-git-main-cartesi.vercel.app
rollups-explorer-sepolia.vercel.app
sepolia-rollups.vercel.app
rollups-explorer-sepolia-cartesi.vercel.app
sepolia.cartesiscan.io