Skip to content

Commit 17b89bf

Browse files
committed
test: increase test coverage of SafeTransactions
There were some uncovered lines in the constructor.
1 parent b04e781 commit 17b89bf

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/safe/transactions.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,29 @@ describe("SafeTransactions", () => {
171171
});
172172
});
173173
});
174+
175+
describe("constructor", () => {
176+
it("throws error when wallet client has no chain ID", () => {
177+
chai.Assertion.expectAssertions(2);
178+
179+
const invalidWalletClient = { ...walletClient, chain: undefined };
180+
181+
try {
182+
new SafeTransactions(
183+
safeAddress,
184+
invalidWalletClient as any,
185+
{
186+
address: contractAddress,
187+
abi: HypercertMinterAbi,
188+
} as any,
189+
);
190+
expect.fail("Should throw Error");
191+
} catch (e) {
192+
expect(e).to.be.instanceOf(Error);
193+
expect((e as Error).message).to.eq("No chain ID found in wallet client");
194+
}
195+
});
196+
});
174197
});
175198

176199
function createConnectedSafeStub(contractAddress: string, mockTxHash: `0x${string}`, mockSignature: `0x${string}`) {

0 commit comments

Comments
 (0)