Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase readability for tests #95

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion yam-www/src/yam/lib/contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export class Contracts {
}

if (confirmationType === Types.ConfirmationType.Simulate) {
let g = txOptions.gas;
const g = txOptions.gas;
return { gasEstimate, g };
}
}
Expand Down
46 changes: 23 additions & 23 deletions yam-www/src/yam/tests/deployment.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ describe("post-deployment", () => {

beforeAll(async () => {
const accounts = await yam.web3.eth.getAccounts();
yam.addAccount(accounts[0]);
user = accounts[0];
yam.addAccount(user);
snapshotId = await yam.testing.snapshot();
});

Expand All @@ -46,111 +46,111 @@ describe("post-deployment", () => {
describe("supply ownership", () => {

test("owner balance", async () => {
let balance = await yam.contracts.yam.methods.balanceOf(user).call();
const balance = await yam.contracts.yam.methods.balanceOf(user).call();
expect(balance).toBe(yam.toBigN(7000000).times(yam.toBigN(10**18)).toString())
});

test("pool balances", async () => {
let ycrv_balance = await yam.contracts.yam.methods.balanceOf(yam.contracts.ycrv_pool.options.address).call();
const ycrv_balance = await yam.contracts.yam.methods.balanceOf(yam.contracts.ycrv_pool.options.address).call();

expect(ycrv_balance).toBe(yam.toBigN(1500000).times(yam.toBigN(10**18)).times(yam.toBigN(1)).toString())

let yfi_balance = await yam.contracts.yam.methods.balanceOf(yam.contracts.yfi_pool.options.address).call();
const yfi_balance = await yam.contracts.yam.methods.balanceOf(yam.contracts.yfi_pool.options.address).call();

expect(yfi_balance).toBe(yam.toBigN(250000).times(yam.toBigN(10**18)).times(yam.toBigN(1)).toString())

let ampl_balance = await yam.contracts.yam.methods.balanceOf(yam.contracts.ampl_pool.options.address).call();
const ampl_balance = await yam.contracts.yam.methods.balanceOf(yam.contracts.ampl_pool.options.address).call();

expect(ampl_balance).toBe(yam.toBigN(250000).times(yam.toBigN(10**18)).times(yam.toBigN(1)).toString())

let eth_balance = await yam.contracts.yam.methods.balanceOf(yam.contracts.eth_pool.options.address).call();
const eth_balance = await yam.contracts.yam.methods.balanceOf(yam.contracts.eth_pool.options.address).call();

expect(eth_balance).toBe(yam.toBigN(250000).times(yam.toBigN(10**18)).times(yam.toBigN(1)).toString())

let snx_balance = await yam.contracts.yam.methods.balanceOf(yam.contracts.snx_pool.options.address).call();
const snx_balance = await yam.contracts.yam.methods.balanceOf(yam.contracts.snx_pool.options.address).call();

expect(snx_balance).toBe(yam.toBigN(250000).times(yam.toBigN(10**18)).times(yam.toBigN(1)).toString())

let comp_balance = await yam.contracts.yam.methods.balanceOf(yam.contracts.comp_pool.options.address).call();
const comp_balance = await yam.contracts.yam.methods.balanceOf(yam.contracts.comp_pool.options.address).call();

expect(comp_balance).toBe(yam.toBigN(250000).times(yam.toBigN(10**18)).times(yam.toBigN(1)).toString())

let lend_balance = await yam.contracts.yam.methods.balanceOf(yam.contracts.lend_pool.options.address).call();
const lend_balance = await yam.contracts.yam.methods.balanceOf(yam.contracts.lend_pool.options.address).call();

expect(lend_balance).toBe(yam.toBigN(250000).times(yam.toBigN(10**18)).times(yam.toBigN(1)).toString())

let link_balance = await yam.contracts.yam.methods.balanceOf(yam.contracts.link_pool.options.address).call();
const link_balance = await yam.contracts.yam.methods.balanceOf(yam.contracts.link_pool.options.address).call();

expect(link_balance).toBe(yam.toBigN(250000).times(yam.toBigN(10**18)).times(yam.toBigN(1)).toString())

let mkr_balance = await yam.contracts.yam.methods.balanceOf(yam.contracts.mkr_pool.options.address).call();
const mkr_balance = await yam.contracts.yam.methods.balanceOf(yam.contracts.mkr_pool.options.address).call();

expect(mkr_balance).toBe(yam.toBigN(250000).times(yam.toBigN(10**18)).times(yam.toBigN(1)).toString())

});

test("total supply", async () => {
let ts = await yam.contracts.yam.methods.totalSupply().call();
const ts = await yam.contracts.yam.methods.totalSupply().call();
expect(ts).toBe("10500000000000000000000000")
});

test("init supply", async () => {
let init_s = await yam.contracts.yam.methods.initSupply().call();
const init_s = await yam.contracts.yam.methods.initSupply().call();
expect(init_s).toBe("10500000000000000000000000000000")
});
});

describe("contract ownership", () => {

test("yam gov", async () => {
let gov = await yam.contracts.yam.methods.gov().call();
const gov = await yam.contracts.yam.methods.gov().call();
expect(gov).toBe(yam.contracts.timelock.options.address)
});

test("rebaser gov", async () => {
let gov = await yam.contracts.rebaser.methods.gov().call();
const gov = await yam.contracts.rebaser.methods.gov().call();
expect(gov).toBe(yam.contracts.timelock.options.address)
});

test("reserves gov", async () => {
let gov = await yam.contracts.reserves.methods.gov().call();
const gov = await yam.contracts.reserves.methods.gov().call();
expect(gov).toBe(yam.contracts.timelock.options.address)
});

test("timelock admin", async () => {
let gov = await yam.contracts.timelock.methods.admin().call();
const gov = await yam.contracts.timelock.methods.admin().call();
expect(gov).toBe(yam.contracts.gov.options.address)
});

test("gov timelock", async () => {
let tl = await yam.contracts.gov.methods.timelock().call();
const tl = await yam.contracts.gov.methods.timelock().call();
expect(tl).toBe(yam.contracts.timelock.options.address)
});

test("gov guardian", async () => {
let grd = await yam.contracts.gov.methods.guardian().call();
const grd = await yam.contracts.gov.methods.guardian().call();
expect(grd).toBe("0x0000000000000000000000000000000000000000")
});

test("pool owner", async () => {
let owner = await yam.contracts.eth_pool.methods.owner().call();
const owner = await yam.contracts.eth_pool.methods.owner().call();
expect(owner).toBe(yam.contracts.timelock.options.address)
});

test("incentives owner", async () => {
let owner = await yam.contracts.ycrv_pool.methods.owner().call();
const owner = await yam.contracts.ycrv_pool.methods.owner().call();
expect(owner).toBe(yam.contracts.timelock.options.address)
});

test("pool rewarder", async () => {
let rewarder = await yam.contracts.eth_pool.methods.rewardDistribution().call();
const rewarder = await yam.contracts.eth_pool.methods.rewardDistribution().call();
expect(rewarder).toBe(yam.contracts.timelock.options.address)
});
});

describe("timelock delay initiated", () => {
test("timelock delay initiated", async () => {
let inited = await yam.contracts.timelock.methods.admin_initialized().call();
const inited = await yam.contracts.timelock.methods.admin_initialized().call();
expect(inited).toBe(true);
})
})
Expand Down
Loading