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:
@ -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'),
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user