From 7fd0ea986294a131dc02bbd0a658c64d6d9332fd Mon Sep 17 00:00:00 2001 From: CJ Hare Date: Fri, 10 Sep 2021 15:48:01 +1000 Subject: [PATCH] feat: Testing minting and burning are deined (#15) --- test/bitdao.test.ts | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/test/bitdao.test.ts b/test/bitdao.test.ts index 3233c83..32965b6 100644 --- a/test/bitdao.test.ts +++ b/test/bitdao.test.ts @@ -3,12 +3,16 @@ import 'hardhat' import '@nomiclabs/hardhat-ethers' // End - Support direct Mocha run & debug -import {expect} from 'chai' +import chai, {expect} from 'chai' import {ethers} from 'hardhat' import {before} from 'mocha' +import {solidity} from 'ethereum-waffle' import {BitDAO} from '../typechain' +chai.use(solidity) + const TEN_OCTILLIAN = 10000000000000000000000000000n +const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000' describe('BitDAO token contract', async () => { before(async () => { @@ -32,6 +36,18 @@ describe('BitDAO token contract', async () => { expect(await dao.balanceOf(admin)).to.equal(TEN_OCTILLIAN) }) + it('minting BIT not allowed', async () => { + expect(dao.transferFrom(ZERO_ADDRESS, admin, 5)).to.be.revertedWith( + 'ERC20: transfer from the zero address' + ) + }) + + it('burning BIT not allowed', async () => { + expect(dao.transferFrom(admin, ZERO_ADDRESS, 5)).to.be.revertedWith( + 'ERC20: transfer to the zero address' + ) + }) + describe('delegate', async () => { beforeEach(async () => { admin = await signer(0) @@ -72,8 +88,6 @@ describe('BitDAO token contract', async () => { }) }) - //TODO test minting (might not work) - //TODO test burning (might not work) //TODO verify emitted events let admin: string