EIP6372.behavior.js 751 B

1234567891011121314151617181920212223
  1. const { clock } = require('../../helpers/time');
  2. function shouldBehaveLikeEIP6372(mode = 'blocknumber') {
  3. describe('should implement EIP6372', 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.be.bignumber.equal(await clock[mode]().then(web3.utils.toBN));
  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.be.equal(mode);
  13. expect(params.get('from')).to.be.equal(mode == 'blocknumber' ? 'default' : null);
  14. });
  15. });
  16. }
  17. module.exports = {
  18. shouldBehaveLikeEIP6372,
  19. };