From b6de7cc86ac105c20c28811bdbdace0c2f7423a8 Mon Sep 17 00:00:00 2001 From: Andy-Alpaca Date: Sun, 1 Nov 2020 09:43:50 -0600 Subject: [PATCH] update master chef test --- test/masterChef.test.ts | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/test/masterChef.test.ts b/test/masterChef.test.ts index d2f2dcb..38d129e 100644 --- a/test/masterChef.test.ts +++ b/test/masterChef.test.ts @@ -88,10 +88,6 @@ describe("MasterChef", () => { } context("Basic infos", async () => { - it("has correct owner", async () => { - expect(await masterChef.owner()).to.eq(owner.address); - }); - it("has correct alpa token contract", async () => { expect(await masterChef.alpa()).to.eq(alpaToken.address); }); @@ -116,10 +112,6 @@ describe("MasterChef", () => { expect(await masterChef.startBlock()).to.eq(STARTING_BLOCK); }); - it("ALPA owner is masterChef", async () => { - expect(await alpaToken.owner()).to.eq(masterChef.address); - }); - it("has correct empty alpaca energy", async () => { expect(await masterChef.EMPTY_ALPACA_ENERGY()).to.eq(1); }); @@ -130,6 +122,28 @@ describe("MasterChef", () => { }); }); + context("Access control", async () => { + it("has correct owner", async () => { + expect(await masterChef.owner()).to.eq(owner.address); + }); + + it("ALPA owner is masterChef", async () => { + expect(await alpaToken.owner()).to.eq(masterChef.address); + }); + + it("can transfer ownership", async () => { + await masterChef.transferOwnership(user1.address); + expect(await masterChef.owner()).to.eq(user1.address); + }); + + it("can transfer alpa ownership", async () => { + expect(await alpaToken.owner()).to.eq(masterChef.address); + + await masterChef.setAlpaOwner(user1.address); + expect(await alpaToken.owner()).to.eq(user1.address); + }); + }) + context("Alpaca operator update energy", async () => { let testAlpaca1: ContractAlpaca; let testAlpaca2: ContractAlpaca;