Created
December 26, 2019 08:18
-
-
Save yurenju/4c9a56ac3fbab61e45fa8273f01214a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { use, expect } from "chai"; | |
import { solidity, createMockProvider, getWallets, deployContract } from 'ethereum-waffle' | |
import * as ERC20TokenJSON from '../build/ERC20Token.json' | |
import { ERC20Token } from '../typed-contracts/ERC20Token' | |
use(solidity); | |
describe('Counter smart contract', () => { | |
const provider = createMockProvider(); | |
const [wallet] = getWallets(provider); | |
async function deployToken(initialSupply: string): Promise<ERC20Token> { | |
const token = await deployContract(wallet, ERC20TokenJSON, [initialSupply]) as ERC20Token; | |
return token; | |
} | |
it('sets initial supply in the constructor', async () => { | |
const token = await deployToken('100000000000000000000'); | |
const totalSupply = await token.totalSupply() | |
expect(totalSupply).to.equal('100000000000000000000'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment