From fd7244e6791c639be21762b85ab0d7d3fbd22ea1 Mon Sep 17 00:00:00 2001 From: Sebastian Markgraf Date: Mon, 19 Feb 2024 14:31:31 +0100 Subject: [PATCH 1/2] fix(test): make snapshot test useful --- package.json | 16 +- .../__snapshots__/common.test.tsx.snap | 835 ++++++++++-------- src/__tests__/common.test.tsx | 2 +- 3 files changed, 491 insertions(+), 362 deletions(-) diff --git a/package.json b/package.json index b361fe3..158c444 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "!**/.*" ], "scripts": { - "test": "jest -u", + "test": "jest", "typecheck": "tsc --noEmit", "lint": "eslint .", "prepack": "bob build", @@ -106,9 +106,7 @@ "node": ">= 16.0.0" }, "commitlint": { - "extends": [ - "@commitlint/config-conventional" - ] + "extends": ["@commitlint/config-conventional"] }, "release-it": { "git": { @@ -129,10 +127,7 @@ }, "eslintConfig": { "root": true, - "extends": [ - "@react-native-community", - "prettier" - ], + "extends": ["@react-native-community", "prettier"], "rules": { "prettier/prettier": [ "error", @@ -146,10 +141,7 @@ ] } }, - "eslintIgnore": [ - "node_modules/", - "lib/" - ], + "eslintIgnore": ["node_modules/", "lib/"], "prettier": { "quoteProps": "consistent", "singleQuote": true, diff --git a/src/__tests__/__snapshots__/common.test.tsx.snap b/src/__tests__/__snapshots__/common.test.tsx.snap index 0db904f..3effb85 100644 --- a/src/__tests__/__snapshots__/common.test.tsx.snap +++ b/src/__tests__/__snapshots__/common.test.tsx.snap @@ -102,7 +102,7 @@ exports[`COMMON TESTS should render with default options 1`] = ` } > - November + February - 2023 + 2024 - - - - 00:12 - - - + - + 1 @@ -591,7 +551,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` - + 2 @@ -662,7 +631,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` - + 3 @@ -733,7 +711,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` - + 4 @@ -804,7 +791,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` - + 5 @@ -875,7 +871,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` - + 6 @@ -946,7 +951,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` - + 7 @@ -1017,7 +1031,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` - + 8 @@ -1088,7 +1111,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` - + 9 @@ -1159,7 +1191,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` - + 10 @@ -1230,7 +1271,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` - + 11 @@ -1301,7 +1351,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` - + 12 @@ -1372,7 +1431,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` - + 13 @@ -1443,7 +1511,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` - + 14 @@ -1514,7 +1591,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` - + 15 @@ -1585,7 +1671,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` 16 @@ -1665,7 +1751,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` - + 17 @@ -1736,7 +1831,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` - + 18 @@ -1807,7 +1911,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` - + 19 @@ -1878,7 +1996,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` - + 20 @@ -1949,7 +2076,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` - + 21 @@ -2020,7 +2156,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` - + 22 @@ -2091,7 +2236,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` - + 23 @@ -2162,7 +2316,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` - + 24 @@ -2233,7 +2396,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` - + 25 @@ -2304,7 +2476,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` - + 26 @@ -2375,7 +2556,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` - + 27 @@ -2446,7 +2636,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` - + 28 @@ -2517,7 +2716,8 @@ exports[`COMMON TESTS should render with default options 1`] = ` - - 29 - - - - - - - - - 30 + > + 29 diff --git a/src/__tests__/common.test.tsx b/src/__tests__/common.test.tsx index b7c2aee..2b4f7b6 100644 --- a/src/__tests__/common.test.tsx +++ b/src/__tests__/common.test.tsx @@ -4,7 +4,7 @@ import DateTimePicker from '../DateTimePicker'; describe('COMMON TESTS', () => { test('should render with default options', () => { - render(); + render(); expect(screen.toJSON()).toMatchSnapshot(); }); }); From dfd0b3d0182c77bca816fe73a93e1816df15072b Mon Sep 17 00:00:00 2001 From: Sebastian Markgraf Date: Mon, 19 Feb 2024 14:52:09 +0100 Subject: [PATCH 2/2] fix: update snapshot --- .../__snapshots__/common.test.tsx.snap | 237 +++++++++++++++--- src/__tests__/common.test.tsx | 2 +- 2 files changed, 204 insertions(+), 35 deletions(-) diff --git a/src/__tests__/__snapshots__/common.test.tsx.snap b/src/__tests__/__snapshots__/common.test.tsx.snap index 3effb85..c634a21 100644 --- a/src/__tests__/__snapshots__/common.test.tsx.snap +++ b/src/__tests__/__snapshots__/common.test.tsx.snap @@ -102,7 +102,7 @@ exports[`COMMON TESTS should render with default options 1`] = ` } > - February + March @@ -468,6 +468,15 @@ exports[`COMMON TESTS should render with default options 1`] = ` } } /> + + + + + + 30 + + + + + + + + + 31 + + + + diff --git a/src/__tests__/common.test.tsx b/src/__tests__/common.test.tsx index 2b4f7b6..8aecc70 100644 --- a/src/__tests__/common.test.tsx +++ b/src/__tests__/common.test.tsx @@ -4,7 +4,7 @@ import DateTimePicker from '../DateTimePicker'; describe('COMMON TESTS', () => { test('should render with default options', () => { - render(); + render(); expect(screen.toJSON()).toMatchSnapshot(); }); });