Skip to content

Commit

Permalink
Added additional checks
Browse files Browse the repository at this point in the history
  • Loading branch information
proxima424 committed Oct 13, 2023
1 parent ef8ca25 commit cdbbd20
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/Smart-Account-Factory.specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,25 +116,33 @@ describe("Smart Account Factory", async () => {
const stakeAmount = ethers.utils.parseEther("1.234256");
const validUnstakeDelay = 600;
const invalidEPAddress = AddressZero;
const depositInfo = await entryPoint.getDepositInfo(
smartAccountFactory.address
);

Check failure on line 121 in test/Smart-Account-Factory.specs.ts

View workflow job for this annotation

GitHub Actions / Lint sources (18.x)

Delete `·····`
await expect(
smartAccountFactory.addStake(invalidEPAddress, validUnstakeDelay, {
value: stakeAmount,
})
).to.be.revertedWith("Invalid EP address");
expect(depositInfo.stake).to.be.equal(0);
});

it("reverts when unstake delay not specified", async () => {
const { smartAccountFactory, smartAccountImplementation, entryPoint } =
await setupTests();
const stakeAmount = ethers.utils.parseEther("1.234256");
const invalidUnstakeDelay = 0;
const depositInfo = await entryPoint.getDepositInfo(
smartAccountFactory.address
);
await expect(
smartAccountFactory.addStake(
entryPoint.address,
invalidUnstakeDelay,
{ value: stakeAmount }
)
).to.be.revertedWith("must specify unstake delay");
expect(depositInfo.stake).to.be.equal(0);
});

it("reverts when trying to decrease unstake time", async () => {
Expand All @@ -157,6 +165,7 @@ describe("Smart Account Factory", async () => {
{ value: stakeAmount }
)
).to.be.revertedWith("cannot decrease unstake time");
expect(depositInfo.unstakeDelaySec).to.be.equal(validUnstakeDelay);
});

it("reverts when stake value not specified", async () => {
Expand Down

0 comments on commit cdbbd20

Please sign in to comment.