From 796ccebd84cf34de4a8302e73ee1cf999f20b990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Wed, 24 Aug 2022 12:55:50 +0100 Subject: [PATCH] Add first Contributor contract test --- test/contracts/Contribution.js | 1 - test/contracts/Contributor.js | 30 ++++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 test/contracts/Contributor.js diff --git a/test/contracts/Contribution.js b/test/contracts/Contribution.js index b6d6a25..d46eed0 100644 --- a/test/contracts/Contribution.js +++ b/test/contracts/Contribution.js @@ -154,5 +154,4 @@ describe("Contribution contract", async function () { }); }); }); - }); diff --git a/test/contracts/Contributor.js b/test/contracts/Contributor.js new file mode 100644 index 0000000..d4f2716 --- /dev/null +++ b/test/contracts/Contributor.js @@ -0,0 +1,30 @@ +const { expect } = require("chai"); +const { ethers, upgrades } = require("hardhat"); +// const { anyValue } = require("@nomicfoundation/hardhat-chai-matchers/withArgs"); +let owner, addr1, addr2, addr3, addr4, addr5, addr6, addr7; +let Contribution, Contributor; + +describe("Contributor contract", async function () { + before(async function () { + [owner, addr1, addr2, addr3, addr4, addr5, addr6, addr7] = await ethers.getSigners(); + // let accounts = [owner, addr1, addr2, addr3, addr4, addr5, addr6, addr7]; + // const contributorFactory = await ethers.getContractFactory("Contributor"); + // Contributor = await upgrades.deployProxy(contributorFactory); + // for (const account of accounts) { + // await Contributor.addContributor(account.address, "0x99b8afd7b266e19990924a8be9099e81054b70c36b20937228a77a5cf75723b8", 18, 32); + // } + }); + + describe("initialize()", function () { + before(async function () { + // const [owner] = await ethers.getSigners(); + const contributorFactory = await ethers.getContractFactory("Contributor"); + Contributor = await upgrades.deployProxy(contributorFactory); + }); + + it("sets the deployer address", async function () { + expect(await Contributor.deployer()).to.equal(owner.address); + expect(await Contributor.deployer()).to.not.equal(addr1.address); + }); + }); +});