Skip to content

Commit e201e53

Browse files
authored
Firestore: equality_matcher.ts: fix missing custom assertion failure message in deep equals (#7519)
* equality_matcher.ts: fix absence of custom message in assertion failure messages * equality_matcher.ts: remove usage of the now-deleted `msg` argument * equality_matcher.ts: fix type of `originalFunction`
1 parent e037eee commit e201e53

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

packages/firestore/test/util/equality_matcher.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ function customDeepEqual(
123123
}
124124

125125
/** The original equality function passed in by chai(). */
126-
let originalFunction: ((r: unknown, l: unknown) => boolean) | null = null;
126+
let originalFunction: ((expected: unknown) => void) | null = null;
127127

128128
export function addEqualityMatcher(
129129
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -136,15 +136,10 @@ export function addEqualityMatcher(
136136
const Assertion = chai.Assertion;
137137

138138
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
139-
const assertEql = (_super: (r: unknown, l: unknown) => boolean) => {
139+
const assertEql = (_super: (expected: unknown) => void) => {
140140
originalFunction = originalFunction || _super;
141-
return function (
142-
this: Chai.Assertion,
143-
expected?: unknown,
144-
msg?: unknown
145-
): void {
141+
return function (this: Chai.Assertion, expected?: unknown): void {
146142
if (isActive) {
147-
utils.flag(this, 'message', msg);
148143
const actual = utils.flag(this, 'object');
149144

150145
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -161,7 +156,7 @@ export function addEqualityMatcher(
161156
/*showDiff=*/ true
162157
);
163158
} else if (originalFunction) {
164-
originalFunction.call(this, expected, msg);
159+
originalFunction.call(this, expected);
165160
}
166161
};
167162
};

0 commit comments

Comments
 (0)