Replace error strings with custom errors (#4261)

This commit is contained in:
Francisco Giordano
2023-06-06 01:08:31 -03:00
parent 253bfa68c2
commit 99a4cfca17
133 changed files with 3157 additions and 1204 deletions

View File

@ -1,7 +1,8 @@
const { expectEvent, expectRevert } = require('@openzeppelin/test-helpers');
const { expectEvent } = require('@openzeppelin/test-helpers');
const { expect } = require('chai');
const zip = require('lodash.zip');
const { expectRevertCustomError } = require('../../helpers/customError');
function shouldBehaveLikeMap(keys, values, zeroValue, methods, events) {
const [keyA, keyB, keyC] = keys;
@ -150,7 +151,10 @@ function shouldBehaveLikeMap(keys, values, zeroValue, methods, events) {
expect(await methods.get(this.map, keyA).then(r => r.toString())).to.be.equal(valueA.toString());
});
it('missing value', async function () {
await expectRevert(methods.get(this.map, keyB), 'EnumerableMap: nonexistent key');
const key = web3.utils.toHex(keyB);
await expectRevertCustomError(methods.get(this.map, keyB), 'EnumerableMapNonexistentKey', [
key.length == 66 ? key : web3.utils.padLeft(key, 64, '0'),
]);
});
});