Skip to content

Commit f043309

Browse files
authored
test: only snapshot anvil state in beforeEach (#3563)
1 parent df5d393 commit f043309

File tree

6 files changed

+6
-7
lines changed

6 files changed

+6
-7
lines changed

packages/common/src/account/kms/kmsKeyToAccount.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ import { waitForTransaction } from "../../test/waitForTransaction";
88
import { getTransactionReceipt, sendTransaction, setBalance } from "viem/actions";
99

1010
describe.skipIf(!process.env.AWS_ENDPOINT_URL)("kmsKeyToAccount", () => {
11+
beforeEach(snapshotAnvilState);
12+
1113
let account: KmsAccount;
1214
let keyId: string;
1315

14-
beforeAll(snapshotAnvilState);
15-
beforeEach(snapshotAnvilState);
16-
1716
beforeAll(async () => {
1817
const client = new KMSClient({
1918
region: "local",

packages/store-sync/src/stash/createStorageAdapter.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { createStash } from "@latticexyz/stash/internal";
88
import { createTestClient, snapshotAnvilState } from "with-anvil";
99

1010
describe("createStorageAdapter", async () => {
11-
beforeAll(snapshotAnvilState);
1211
beforeEach(snapshotAnvilState);
1312

1413
beforeAll(async () => {

packages/store-sync/src/zustand/createStorageAdapter.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { getBlockNumber } from "viem/actions";
88
import { createTestClient, snapshotAnvilState } from "with-anvil";
99

1010
describe("createStorageAdapter", async () => {
11-
beforeAll(snapshotAnvilState);
1211
beforeEach(snapshotAnvilState);
1312

1413
beforeAll(async () => {

packages/store/ts/flattenStoreLogs.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { summarizeLogs } from "./test/summarizeLogs";
77
import { createTestClient, snapshotAnvilState } from "with-anvil";
88

99
describe("flattenStoreLogs", async () => {
10-
beforeAll(snapshotAnvilState);
1110
beforeEach(snapshotAnvilState);
1211

1312
beforeAll(async () => {

packages/store/ts/getStoreLogs.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { summarizeLogs } from "./test/summarizeLogs";
77
import { createTestClient, snapshotAnvilState } from "with-anvil";
88

99
describe("getStoreLogs", async () => {
10-
beforeAll(snapshotAnvilState);
1110
beforeEach(snapshotAnvilState);
1211

1312
beforeAll(async () => {
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import { dumpState, loadState } from "viem/actions";
22
import { createTestClient } from "./createTestClient";
3+
import { getAnvilRpcUrl } from "./getAnvilRpcUrl";
34

45
export async function snapshotAnvilState() {
56
const testClient = createTestClient();
7+
const rpcUrl = getAnvilRpcUrl();
8+
console.log("snapshotting", rpcUrl);
69
const state = await dumpState(testClient);
710
return async (): Promise<void> => {
11+
console.log("reverting to snapshot", rpcUrl);
812
await loadState(testClient, { state });
913
};
1014
}

0 commit comments

Comments
 (0)