Skip to content

Commit

Permalink
explorer: integrate Transaction Details payload fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
deuch13 committed May 15, 2024
1 parent 8c02f30 commit 8dae309
Show file tree
Hide file tree
Showing 5 changed files with 395 additions and 7 deletions.
14 changes: 13 additions & 1 deletion explorer/src/lib/components/__tests__/TransactionDetails.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { afterAll, afterEach, describe, expect, it, vi } from "vitest";
import { cleanup, render } from "@testing-library/svelte";
import { cleanup, fireEvent, render } from "@testing-library/svelte";
import { apiTransaction } from "$lib/mock-data";
import { transformTransaction } from "$lib/chain-info";
import { TransactionDetails } from "../";
Expand All @@ -14,12 +14,16 @@ const baseProps = {
data: transformTransaction(apiTransaction.data[0]),
error: null,
loading: false,
payload:
"db0794770322802a22905c4364511f3186e6184085f875dbb9f11a3ae914766c020000000000000014bc23b875c67d0dbecfdd45f5964f3fea7188aff2035730c8802",
};

describe("Transaction Details", () => {
vi.useFakeTimers();
vi.setSystemTime(new Date(2024, 4, 20));

afterEach(cleanup);

afterAll(() => {
vi.useRealTimers();
});
Expand All @@ -29,4 +33,12 @@ describe("Transaction Details", () => {

expect(container.firstChild).toMatchSnapshot();
});

it("renders the Transaction Details component with the payload visible", async () => {
const { container, getByRole } = render(TransactionDetails, baseProps);

await fireEvent.click(getByRole("switch"));

expect(container.firstChild).toMatchSnapshot();
});
});
Loading

0 comments on commit 8dae309

Please sign in to comment.