Skip to content

Commit f209815

Browse files
authored
refactor: enhance ERC6372 behavior test with detailed checks (#5164)
1 parent 3f90169 commit f209815

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

test/governance/utils/ERC6372.behavior.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
const { expect } = require('chai');
2-
32
const time = require('../../helpers/time');
43

54
function shouldBehaveLikeERC6372(mode = 'blocknumber') {
6-
describe('should implement ERC-6372', function () {
5+
describe(`ERC-6372 behavior in ${mode} mode`, function () {
76
beforeEach(async function () {
87
this.mock = this.mock ?? this.token ?? this.votes;
98
});
109

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`);
1314
});
1415

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}`);
1922
});
2023
});
2124
}

0 commit comments

Comments
 (0)