ERC20Metadata.test.js 811 B

1234567891011121314151617181920212223242526
  1. const { contract } = require('@openzeppelin/test-environment');
  2. require('@openzeppelin/test-helpers');
  3. const ERC20MetadataMock = contract.fromArtifact('ERC20MetadataMock');
  4. const { expect } = require('chai');
  5. const metadataURI = 'https://example.com';
  6. describe('ERC20Metadata', function () {
  7. beforeEach(async function () {
  8. this.token = await ERC20MetadataMock.new(metadataURI);
  9. });
  10. it('responds with the metadata', async function () {
  11. expect(await this.token.tokenURI()).to.equal(metadataURI);
  12. });
  13. describe('setTokenURI', function () {
  14. it('changes the original URI', async function () {
  15. const newMetadataURI = 'https://betterexample.com';
  16. await this.token.setTokenURI(newMetadataURI);
  17. expect(await this.token.tokenURI()).to.equal(newMetadataURI);
  18. });
  19. });
  20. });