diff --git a/packages/jest-types/__typetests__/expect.test.ts b/packages/jest-types/__typetests__/expect.test.ts index dbed505d98df..7300bb59261c 100644 --- a/packages/jest-types/__typetests__/expect.test.ts +++ b/packages/jest-types/__typetests__/expect.test.ts @@ -415,6 +415,38 @@ expectError( }), ); +expectType(expect('abc').toMatchNamedSnapshot('snapshot name')); + +expectType( + expect({ + date: new Date(), + name: 'John Doe', + }).toMatchNamedSnapshot('snapshot name', { + date: expect.any(Date), + name: expect.any(String), + }), +); + +expectType( + expect({ + date: new Date(), + name: 'John Doe', + }).toMatchNamedSnapshot('snapshot name', { + date: expect.any(Date), + name: expect.any(String), + }), +); + +expectError( + expect({ + date: new Date(), + name: 'John Doe', + }).toMatchNamedSnapshot('snapshot name', { + date: expect.any(Date), + time: expect.any(Date), + }), +); + expectType(expect(jest.fn()).toThrowErrorMatchingSnapshot()); expectType(expect(jest.fn()).toThrowErrorMatchingSnapshot('hint')); expectError(expect(jest.fn()).toThrowErrorMatchingSnapshot(true));