Add tests for improved coverage (#3448)

Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
This commit is contained in:
Hadrien Croubois
2022-06-03 01:01:55 +02:00
committed by GitHub
parent 04204b8fb9
commit 35090c1bf1
9 changed files with 81 additions and 69 deletions

View File

@ -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');
});
});
});