Skip to content

Commit c630e21

Browse files
test: Added tests for Base_SpokePool
Signed-off-by: Dhruv-Varshney-Developer <f20200865@pilani.bits-pilani.ac.in>
1 parent aec5098 commit c630e21

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

test/evm/hardhat/chain-specific-spokepools/Base_SpokePool.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ let hubPool: Contract, spokePool: Contract, weth: Contract, usdc: Contract;
88
let owner: SignerWithAddress;
99
let cctpTokenMessenger: FakeContract;
1010

11-
// ABI for CCTP Token Messenger
1211
const tokenMessengerAbi = [
1312
{
1413
inputs: [],
@@ -25,12 +24,10 @@ describe("Base Spoke Pool", function () {
2524
({ weth, usdc, hubPool } = await hubPoolFixture());
2625

2726
cctpTokenMessenger = await smock.fake(tokenMessengerAbi);
28-
cctpTokenMessenger.localToken.returns(usdc.address);
2927

30-
// Deploy Base SpokePool
3128
spokePool = await hre.upgrades.deployProxy(
3229
await getContractFactory("Base_SpokePool", owner),
33-
[0, hubPool.address, hubPool.address],
30+
[0, owner.address, hubPool.address],
3431
{
3532
kind: "uups",
3633
unsafeAllow: ["delegatecall"],
@@ -40,21 +37,26 @@ describe("Base Spoke Pool", function () {
4037
});
4138

4239
describe("Initialization", function () {
43-
it("Should initialize with correct parameters", async function () {
44-
expect(await spokePool._l2Usdc).to.equal(usdc.address);
40+
it("Should initialize with correct constructor parameters", async function () {
41+
expect(await spokePool.wrappedNativeToken()).to.equal(weth.address);
42+
expect(await spokePool.usdcToken()).to.equal(usdc.address);
4543
expect(await spokePool.cctpTokenMessenger()).to.equal(cctpTokenMessenger.address);
4644
});
4745

48-
it("Should start with deposit ID 0", async function () {
46+
it("Should initialize with correct proxy parameters", async function () {
4947
expect(await spokePool.numberOfDeposits()).to.equal(0);
48+
expect(await spokePool.crossDomainAdmin()).to.equal(owner.address);
49+
expect(await spokePool.withdrawalRecipient()).to.equal(hubPool.address);
50+
});
51+
52+
it("Should initialize with correct OVM_ETH", async function () {
53+
expect(await spokePool.l2Eth()).to.equal("0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000");
5054
});
5155
});
5256

5357
describe("Error cases", function () {
54-
it("Should revert if trying to initialize twice", async function () {
55-
await expect(spokePool.initialize(0, hubPool.address, hubPool.address)).to.be.revertedWith(
56-
"Initializable: contract is already initialized"
57-
);
58+
it("Should revert on reinitialization", async function () {
59+
await expect(spokePool.connect(owner).initialize(0, owner.address, hubPool.address)).to.be.reverted;
5860
});
5961
});
6062
});

0 commit comments

Comments
 (0)