-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: define matchers in separate files
- Loading branch information
1 parent
c95be72
commit 6aadc02
Showing
4 changed files
with
44 additions
and
13 deletions.
There are no files selected for viewing
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,5 @@ | ||
import toMatchObject from './toMatchObject' | ||
|
||
export default [ | ||
toMatchObject, | ||
] |
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,13 @@ | ||
import { defineAssertion } from '../utils' | ||
import { iterableEquality, equals as jestEquals, subsetEquality } from '../jest-utils' | ||
|
||
export default defineAssertion('toMatchObject', function (expected: unknown) { | ||
const actual = this._obj as unknown | ||
this.assert( | ||
jestEquals(actual, expected, [iterableEquality, subsetEquality]), | ||
'expected #{this} to match object #{exp}', | ||
'expected #{this} to not match object #{exp}', | ||
expected, | ||
actual, | ||
) | ||
}) |
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
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