Nonces.test.js 730 B

12345678910111213141516171819202122232425
  1. require('@openzeppelin/test-helpers');
  2. const NoncesImpl = artifacts.require('NoncesImpl');
  3. contract('Nonces', function (accounts) {
  4. const [ sender, other ] = accounts;
  5. beforeEach(async function () {
  6. this.nonces = await NoncesImpl.new();
  7. });
  8. it('gets a nonce', async function () {
  9. expect(await this.nonces.nonces(sender)).to.be.bignumber.equal('0');
  10. });
  11. it('increment a nonce', async function () {
  12. await this.nonces.useNonce(sender);
  13. expect(await this.nonces.nonces(sender)).to.be.bignumber.equal('1');
  14. });
  15. it('nonce is specific to address argument', async function () {
  16. await this.nonces.useNonce(sender);
  17. expect(await this.nonces.nonces(other)).to.be.bignumber.equal('0');
  18. });
  19. });