ERC6372.behavior.js 748 B

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