SimpleToken.test.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. const { constants, expectEvent } = require('openzeppelin-test-helpers');
  2. const { ZERO_ADDRESS } = constants;
  3. const SimpleToken = artifacts.require('SimpleToken');
  4. contract('SimpleToken', function ([_, creator]) {
  5. beforeEach(async function () {
  6. this.token = await SimpleToken.new({ from: creator });
  7. });
  8. it('has a name', async function () {
  9. (await this.token.name()).should.equal('SimpleToken');
  10. });
  11. it('has a symbol', async function () {
  12. (await this.token.symbol()).should.equal('SIM');
  13. });
  14. it('has 18 decimals', async function () {
  15. (await this.token.decimals()).should.be.bignumber.equal('18');
  16. });
  17. it('assigns the initial total supply to the creator', async function () {
  18. const totalSupply = await this.token.totalSupply();
  19. const creatorBalance = await this.token.balanceOf(creator);
  20. creatorBalance.should.be.bignumber.equal(totalSupply);
  21. await expectEvent.inConstruction(this.token, 'Transfer', {
  22. from: ZERO_ADDRESS,
  23. to: creator,
  24. value: totalSupply,
  25. });
  26. });
  27. });