ERC165Storage.test.js 799 B

1234567891011121314151617181920212223
  1. const { expectRevert } = require('@openzeppelin/test-helpers');
  2. const { shouldSupportInterfaces } = require('./SupportsInterface.behavior');
  3. const ERC165Storage = artifacts.require('$ERC165Storage');
  4. contract('ERC165Storage', function () {
  5. beforeEach(async function () {
  6. this.mock = await ERC165Storage.new();
  7. });
  8. it('register interface', async function () {
  9. expect(await this.mock.supportsInterface('0x00000001')).to.be.equal(false);
  10. await this.mock.$_registerInterface('0x00000001');
  11. expect(await this.mock.supportsInterface('0x00000001')).to.be.equal(true);
  12. });
  13. it('does not allow 0xffffffff', async function () {
  14. await expectRevert(this.mock.$_registerInterface('0xffffffff'), 'ERC165: invalid interface id');
  15. });
  16. shouldSupportInterfaces(['ERC165']);
  17. });