Replace revert strings with custom errors (#4261)

Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Francisco <fg@frang.io>
This commit is contained in:
Ernesto García
2023-06-12 17:41:52 -06:00
committed by GitHub
parent 08fd777f6d
commit b425a72240
138 changed files with 3220 additions and 1287 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'),
]);
});
});