From ed4e6057765ca8da3e7a81fb2a03f06a7f828134 Mon Sep 17 00:00:00 2001 From: Art Date: Mon, 10 Apr 2023 18:13:19 +0700 Subject: [PATCH] add e2e type test --- .../jest-types/__typetests__/expect.test.ts | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) 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));