Add tests for improved coverage (#3448)
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
This commit is contained in:
@ -2,6 +2,8 @@ const { expectRevert, time } = require('@openzeppelin/test-helpers');
|
||||
|
||||
const { expect } = require('chai');
|
||||
|
||||
const { batchInBlock } = require('../helpers/txpool');
|
||||
|
||||
const CheckpointsImpl = artifacts.require('CheckpointsImpl');
|
||||
|
||||
contract('Checkpoints', function (accounts) {
|
||||
@ -55,5 +57,18 @@ contract('Checkpoints', function (accounts) {
|
||||
'Checkpoints: block not yet mined',
|
||||
);
|
||||
});
|
||||
|
||||
it('multiple checkpoints in the same block', async function () {
|
||||
const lengthBefore = await this.checkpoint.length();
|
||||
await batchInBlock([
|
||||
() => this.checkpoint.push(8, { gas: 100000 }),
|
||||
() => this.checkpoint.push(9, { gas: 100000 }),
|
||||
() => this.checkpoint.push(10, { gas: 100000 }),
|
||||
]);
|
||||
const lengthAfter = await this.checkpoint.length();
|
||||
|
||||
expect(lengthAfter.toNumber()).to.be.equal(lengthBefore.toNumber() + 1);
|
||||
expect(await this.checkpoint.latest()).to.be.bignumber.equal('10');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user