Skip to content

Instantly share code, notes, and snippets.

@yurenju
Created December 26, 2019 08:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yurenju/4c9a56ac3fbab61e45fa8273f01214a7 to your computer and use it in GitHub Desktop.
Save yurenju/4c9a56ac3fbab61e45fa8273f01214a7 to your computer and use it in GitHub Desktop.
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