Skip to content

Commit

Permalink
wip anvil test
Browse files Browse the repository at this point in the history
  • Loading branch information
holic committed Jun 26, 2023
1 parent 51a7be0 commit 1952a98
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/block-events-stream/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
},
"devDependencies": {
"@types/debug": "^4.1.7",
"@viem/anvil": "^0.0.6",
"tsup": "^6.7.0",
"vitest": "0.31.4"
},
Expand Down
28 changes: 28 additions & 0 deletions packages/block-events-stream/src/createBlockEventsStream.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { describe, expect, it } from "vitest";
import { createBlockEventsStream } from "./createBlockEventsStream";
import { createPublicClient, createTestClient, http } from "viem";
import { foundry } from "viem/chains";
import { storeEventsAbi } from "@latticexyz/store";
import { createAnvil } from "@viem/anvil";

describe("createBlockEventsStream", () => {
it("streams events grouped by block", async () => {
const anvil = createAnvil();
await anvil.start();

const publicClient = createPublicClient({
chain: foundry,
transport: http(),
});

const testClient = createTestClient({
chain: foundry,
mode: "anvil",
transport: http(),
});

const block$ = await createBlockEventsStream({ publicClient, events: storeEventsAbi });

await anvil.stop();
});
});
54 changes: 47 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1952a98

Please sign in to comment.