Add a Counter.reset function (#2678)

This commit is contained in:
Hadrien Croubois
2021-05-19 20:52:43 +02:00
committed by GitHub
parent c3ae4790c7
commit 8ea06b75aa
5 changed files with 31 additions and 2 deletions

View File

@ -61,4 +61,24 @@ contract('Counters', function (accounts) {
});
});
});
describe('reset', function () {
context('null counter', function () {
it('does not throw', async function () {
await this.counter.reset();
expect(await this.counter.current()).to.be.bignumber.equal('0');
});
});
context('non null counter', function () {
beforeEach(async function () {
await this.counter.increment();
expect(await this.counter.current()).to.be.bignumber.equal('1');
});
it('reset to 0', async function () {
await this.counter.reset();
expect(await this.counter.current()).to.be.bignumber.equal('0');
});
});
});
});