ERC777PresetFixedSupply.test.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. const { BN, singletons } = require('@openzeppelin/test-helpers');
  2. const { expect } = require('chai');
  3. const ERC777PresetFixedSupply = artifacts.require('ERC777PresetFixedSupply');
  4. contract('ERC777PresetFixedSupply', function (accounts) {
  5. const [registryFunder, owner, defaultOperatorA, defaultOperatorB, anyone] = accounts;
  6. const initialSupply = new BN('10000');
  7. const name = 'ERC777Preset';
  8. const symbol = '777P';
  9. const defaultOperators = [defaultOperatorA, defaultOperatorB];
  10. before(async function () {
  11. await singletons.ERC1820Registry(registryFunder);
  12. });
  13. beforeEach(async function () {
  14. this.token = await ERC777PresetFixedSupply.new(name, symbol, defaultOperators, initialSupply, owner);
  15. });
  16. it('returns the name', async function () {
  17. expect(await this.token.name()).to.equal(name);
  18. });
  19. it('returns the symbol', async function () {
  20. expect(await this.token.symbol()).to.equal(symbol);
  21. });
  22. it('returns the default operators', async function () {
  23. expect(await this.token.defaultOperators()).to.deep.equal(defaultOperators);
  24. });
  25. it('default operators are operators for all accounts', async function () {
  26. for (const operator of defaultOperators) {
  27. expect(await this.token.isOperatorFor(operator, anyone)).to.equal(true);
  28. }
  29. });
  30. it('returns the total supply equal to initial supply', async function () {
  31. expect(await this.token.totalSupply()).to.be.bignumber.equal(initialSupply);
  32. });
  33. it('returns the balance of owner equal to initial supply', async function () {
  34. expect(await this.token.balanceOf(owner)).to.be.bignumber.equal(initialSupply);
  35. });
  36. });