Skip to content

Commit

Permalink
Adds test for undefined call.inputs.
Browse files Browse the repository at this point in the history
  • Loading branch information
robotoer committed Aug 21, 2024
1 parent dd60f0f commit 98a5392
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/mock-contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,27 @@ describe("Doppelganger", function () {
}
});

it("Should allow undefined call.inputs for read calls", async function () {
const [signer] = await hre.viem.getWalletClients();
const reader = await hre.viem.getPublicClient();

const mock = await deployMock(signer, reader);
await mock.setup<ExtractAbiFunction<typeof erc20ABI, "balanceOf">>({
kind: "read",
abi: erc20ABI[0],
outputs: [100n],
});

expect(
await reader.readContract({
address: mock.address,
abi: erc20ABI,
functionName: "balanceOf",
args: [zeroAddress],
}),
).to.equal(100n);
});

// TODO:
it.skip("Should allow for the mocking of events", async function () {});
});
Expand Down

0 comments on commit 98a5392

Please sign in to comment.