Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
BedrockSquirrel committed Sep 28, 2023
1 parent b664a6e commit bb55472
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions contracts/test/bridge-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,22 +307,25 @@ describe("Bridge", function () {
payload: decodedEvent.args[4],
consistencyLevel: decodedEvent.args[5]
})).to.be.revertedWith("Message not found or finalized.");
});
});129023860752390064

it("MessageBus retrieveAllFunds method should allow owner to extract all native funds from the message bus", async function() {
const [owner] = await ethers.getSigners();
const amount = ethers.utils.parseEther("0.01");

// send native funds to message bus contract on the L1
const tx = await owner.sendTransaction({
to: busL1.address,
value: ethers.utils.parseEther("10.0")
const tx = await busL1.sendValueToL2(owner.address, amount, {
value: amount
});
await expect(tx).to.not.be.reverted;

// check that the funds were received
await expect(await ethers.provider.getBalance(busL1.address)).to.equal(amount);

// retrieve all native funds from the message bus contract on the L1
const retrieveAllFundsTx = busL1.retrieveAllFunds(owner.address);
await expect(retrieveAllFundsTx).to.not.be.reverted;

// check that the owner received the native funds
await expect(await ethers.provider.getBalance(owner.address)).to.equal(ethers.utils.parseEther("10.0"));
// check that the funds were drained
await expect(await ethers.provider.getBalance(busL1.address)).to.equal(0);
});
});

0 comments on commit bb55472

Please sign in to comment.