@types/jest: toMatchSnapshot updated for property matchers (#27170)

This commit is contained in:
Andy
2018-07-12 00:49:45 -07:00
committed by Ryan Cavanaugh
parent d9bf730cb2
commit dfe05a96d6
2 changed files with 12 additions and 1 deletions
+6 -1
View File
@@ -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.
+6
View File
@@ -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();