Skip to content

Commit 9c58f30

Browse files
committed
include extra verification
1 parent 1dbc6dc commit 9c58f30

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

packages/hardhat-chai-matchers/src/internal/emit.ts

+2
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ const tryAssertArgsArraysEqual = (
169169
expectedArgs,
170170
parsedLog.args,
171171
`"${eventName}" event`,
172+
"event",
172173
assert,
173174
ssfi
174175
);
@@ -188,6 +189,7 @@ const tryAssertArgsArraysEqual = (
188189
expectedArgs,
189190
parsedLog.args,
190191
`"${eventName}" event`,
192+
"event",
191193
assert,
192194
ssfi
193195
);

packages/hardhat-chai-matchers/src/internal/reverted/revertedWithCustomError.ts

+1
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ export async function revertedWithCustomErrorWithArgs(
219219
expectedArgs,
220220
actualArgs,
221221
`"${customError.name}" custom error`,
222+
"error",
222223
assert,
223224
ssfi
224225
);

packages/hardhat-chai-matchers/src/internal/utils.ts

+10
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export function assertArgsArraysEqual(
4949
expectedArgs: any[],
5050
actualArgs: any[],
5151
tag: string,
52+
assertionType: "event" | "error",
5253
assert: AssertWithSsfi,
5354
ssfi: Ssfi
5455
) {
@@ -57,6 +58,7 @@ export function assertArgsArraysEqual(
5758
Assertion,
5859
expectedArgs,
5960
actualArgs,
61+
assertionType,
6062
assert,
6163
ssfi
6264
);
@@ -70,6 +72,7 @@ export function assertArgsArraysEqualNested(
7072
Assertion: Chai.AssertionStatic,
7173
expectedArgs: any[],
7274
actualArgs: any[],
75+
assertionType: "event" | "error",
7376
assert: AssertWithSsfi,
7477
ssfi: Ssfi
7578
) {
@@ -110,11 +113,18 @@ export function assertArgsArraysEqualNested(
110113
Assertion,
111114
expectedArg,
112115
actualArg,
116+
assertionType,
113117
assert,
114118
ssfi
115119
);
116120
} else {
117121
if (actualArg.hash !== undefined && actualArg._isIndexed === true) {
122+
if (assertionType !== "event")
123+
assert(
124+
false,
125+
"Should not get here. Please open an issue about that"
126+
);
127+
118128
new Assertion(actualArg.hash, undefined, ssfi, true).to.not.equal(
119129
expectedArg,
120130
"The actual value was an indexed and hashed value of the event argument. The expected value provided to the assertion should be the actual event argument (the pre-image of the hash). You provided the hash itself. Please supply the actual event argument (the pre-image of the hash) instead."

0 commit comments

Comments
 (0)