|
1 | 1 | const { expect } = require('chai');
|
2 |
| - |
3 | 2 | const time = require('../../helpers/time');
|
4 | 3 |
|
5 | 4 | function shouldBehaveLikeERC6372(mode = 'blocknumber') {
|
6 |
| - describe('should implement ERC-6372', function () { |
| 5 | + describe(`ERC-6372 behavior in ${mode} mode`, function () { |
7 | 6 | beforeEach(async function () {
|
8 | 7 | this.mock = this.mock ?? this.token ?? this.votes;
|
9 | 8 | });
|
10 | 9 |
|
11 |
| - it('clock is correct', async function () { |
12 |
| - expect(await this.mock.clock()).to.equal(await time.clock[mode]()); |
| 10 | + it('should have a correct clock value', async function () { |
| 11 | + const currentClock = await this.mock.clock(); |
| 12 | + const expectedClock = await time.clock[mode](); |
| 13 | + expect(currentClock).to.equal(expectedClock, `Clock mismatch in ${mode} mode`); |
13 | 14 | });
|
14 | 15 |
|
15 |
| - it('CLOCK_MODE is correct', async function () { |
16 |
| - const params = new URLSearchParams(await this.mock.CLOCK_MODE()); |
17 |
| - expect(params.get('mode')).to.equal(mode); |
18 |
| - expect(params.get('from')).to.equal(mode == 'blocknumber' ? 'default' : null); |
| 16 | + it('should have the correct CLOCK_MODE parameters', async function () { |
| 17 | + const clockModeParams = new URLSearchParams(await this.mock.CLOCK_MODE()); |
| 18 | + const expectedFromValue = mode === 'blocknumber' ? 'default' : null; |
| 19 | + |
| 20 | + expect(clockModeParams.get('mode')).to.equal(mode, `Expected mode to be ${mode}`); |
| 21 | + expect(clockModeParams.get('from')).to.equal(expectedFromValue, `Expected 'from' to be ${expectedFromValue}`); |
19 | 22 | });
|
20 | 23 | });
|
21 | 24 | }
|
|
0 commit comments