Merge branch 'master' into next-v5.0

This commit is contained in:
Hadrien Croubois
2023-01-14 18:51:03 -03:00
committed by Francisco Giordano
265 changed files with 5659 additions and 8542 deletions

View File

@ -1,12 +1,14 @@
const expectEvent = require('@openzeppelin/test-helpers/src/expectEvent');
require('@openzeppelin/test-helpers');
const NoncesImpl = artifacts.require('NoncesImpl');
const Nonces = artifacts.require('$Nonces');
contract('Nonces', function (accounts) {
const [ sender, other ] = accounts;
const [sender, other] = accounts;
beforeEach(async function () {
this.nonces = await NoncesImpl.new();
this.nonces = await Nonces.new();
});
it('gets a nonce', async function () {
@ -14,12 +16,21 @@ contract('Nonces', function (accounts) {
});
it('increment a nonce', async function () {
await this.nonces.useNonce(sender);
expect(await this.nonces.nonces(sender)).to.be.bignumber.equal('0');
const { receipt } = await this.nonces.$_useNonce(sender);
expectEvent(receipt, 'return$_useNonce', { current: '0' });
expect(await this.nonces.nonces(sender)).to.be.bignumber.equal('1');
});
it('nonce is specific to address argument', async function () {
await this.nonces.useNonce(sender);
expect(await this.nonces.nonces(sender)).to.be.bignumber.equal('0');
expect(await this.nonces.nonces(other)).to.be.bignumber.equal('0');
await this.nonces.$_useNonce(sender);
expect(await this.nonces.nonces(sender)).to.be.bignumber.equal('1');
expect(await this.nonces.nonces(other)).to.be.bignumber.equal('0');
});
});