mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-11-29 17:51:46 +00:00
@types/jest: toMatchSnapshot updated for property matchers (#27170)
This commit is contained in:
Vendored
+6
-1
@@ -394,7 +394,7 @@ declare namespace jest {
|
||||
*
|
||||
* @param actual The value to apply matchers against.
|
||||
*/
|
||||
(actual: any): Matchers<void>;
|
||||
<T = any>(actual: T): Matchers<T>;
|
||||
/**
|
||||
* Matches anything but null or undefined. You can use it inside `toEqual` or `toBeCalledWith` instead
|
||||
* of a literal value. For example, if you want to check that a mock function is called with a
|
||||
@@ -651,6 +651,11 @@ declare namespace jest {
|
||||
* Used to check that a JavaScript object matches a subset of the properties of an object
|
||||
*/
|
||||
toMatchObject(expected: {} | any[]): R;
|
||||
/**
|
||||
* This ensures that a value matches the most recent snapshot with property matchers.
|
||||
* Check out [the Snapshot Testing guide](http://facebook.github.io/jest/docs/snapshot-testing.html) for more information.
|
||||
*/
|
||||
toMatchSnapshot<T extends {[P in keyof R]: Expect['any']}>(propertyMatchers: Partial<T>, snapshotName?: string): R;
|
||||
/**
|
||||
* This ensures that a value matches the most recent snapshot.
|
||||
* Check out [the Snapshot Testing guide](http://facebook.github.io/jest/docs/snapshot-testing.html) for more information.
|
||||
|
||||
@@ -610,6 +610,12 @@ describe("", () => {
|
||||
|
||||
expect({}).toMatchSnapshot();
|
||||
expect({}).toMatchSnapshot("snapshotName");
|
||||
expect({ abc: "def" }).toMatchSnapshot({ abc: expect.any(String) }, "snapshotName");
|
||||
expect({
|
||||
one: 1,
|
||||
two: "2",
|
||||
date: new Date(),
|
||||
}).toMatchSnapshot({ one: expect.any(Number), date: expect.any(Date) });
|
||||
|
||||
expect(jest.fn()).toReturn();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user