ERC6372.behavior.js 723 B

1234567891011121314151617181920212223
  1. const { bigint: time } = require('../../helpers/time');
  2. function shouldBehaveLikeERC6372(mode = 'blocknumber') {
  3. describe('should implement ERC-6372', function () {
  4. beforeEach(async function () {
  5. this.mock = this.mock ?? this.token ?? this.votes;
  6. });
  7. it('clock is correct', async function () {
  8. expect(await this.mock.clock()).to.equal(await time.clock[mode]());
  9. });
  10. it('CLOCK_MODE is correct', async function () {
  11. const params = new URLSearchParams(await this.mock.CLOCK_MODE());
  12. expect(params.get('mode')).to.equal(mode);
  13. expect(params.get('from')).to.equal(mode == 'blocknumber' ? 'default' : null);
  14. });
  15. });
  16. }
  17. module.exports = {
  18. shouldBehaveLikeERC6372,
  19. };