-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7339029
commit 318ad6f
Showing
5 changed files
with
51 additions
and
46 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { defineAssertion } from '../utils' | ||
import { iterableEquality, equals as jestEquals } from '../jest-utils' | ||
import { getCustomEqualityTesters } from '../jest-matcher-utils' | ||
|
||
export default defineAssertion('toEqual', function (expected: unknown) { | ||
const customTesters = getCustomEqualityTesters() | ||
const actual = this._obj | ||
const equal = jestEquals( | ||
actual, | ||
expected, | ||
[...customTesters, iterableEquality], | ||
) | ||
|
||
return this.assert( | ||
equal, | ||
'expected #{this} to deeply equal #{exp}', | ||
'expected #{this} to not deeply equal #{exp}', | ||
expected, | ||
actual, | ||
) | ||
}) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { defineAssertion } from '../utils' | ||
import { arrayBufferEquality, iterableEquality, equals as jestEquals, sparseArrayEquality, typeEquality } from '../jest-utils' | ||
import { getCustomEqualityTesters } from '../jest-matcher-utils' | ||
|
||
export default defineAssertion('toStrictEqual', function (expected: unknown) { | ||
const customTesters = getCustomEqualityTesters() | ||
const obj = this._obj | ||
const equal = jestEquals( | ||
obj, | ||
expected, | ||
[ | ||
...customTesters, | ||
iterableEquality, | ||
typeEquality, | ||
sparseArrayEquality, | ||
arrayBufferEquality, | ||
], | ||
true, | ||
) | ||
|
||
return this.assert( | ||
equal, | ||
'expected #{this} to strictly equal #{exp}', | ||
'expected #{this} to not strictly equal #{exp}', | ||
expected, | ||
obj, | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters