From 0c002e5ce4962faa2d8b54f09f97b6270e5885f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Sat, 31 Aug 2019 00:09:20 +0100 Subject: [PATCH] fix(tests): update tests for react-datepicker 2.9.3 --- .../__snapshots__/index.test.js.snap | 74 ++++++++++++++++++- .../SilenceModal/DateTimeSelect/index.test.js | 30 +++----- 2 files changed, 84 insertions(+), 20 deletions(-) diff --git a/ui/src/Components/SilenceModal/DateTimeSelect/__snapshots__/index.test.js.snap b/ui/src/Components/SilenceModal/DateTimeSelect/__snapshots__/index.test.js.snap index 21e2131be..8d85e8145 100644 --- a/ui/src/Components/SilenceModal/DateTimeSelect/__snapshots__/index.test.js.snap +++ b/ui/src/Components/SilenceModal/DateTimeSelect/__snapshots__/index.test.js.snap @@ -274,7 +274,7 @@ exports[` 'Ends' tab matches snapshot 1`] = `
@@ -315,42 +315,49 @@ exports[` 'Ends' tab matches snapshot 1`] = `
30
31
1
2
3
4
5
@@ -359,42 +366,49 @@ exports[` 'Ends' tab matches snapshot 1`] = `
6
7
8
9
10
11
12
@@ -403,42 +417,49 @@ exports[` 'Ends' tab matches snapshot 1`] = `
13
14
15
16
17
18
19
@@ -447,42 +468,49 @@ exports[` 'Ends' tab matches snapshot 1`] = `
20
21
22
23
24
25
26
@@ -491,42 +519,49 @@ exports[` 'Ends' tab matches snapshot 1`] = `
27
28
1
2
3
4
5
@@ -685,7 +720,7 @@ exports[` 'Starts' tab matches snapshot 1`] = `
@@ -726,42 +761,49 @@ exports[` 'Starts' tab matches snapshot 1`] = `
1
2
3
4
5
6
7
@@ -770,42 +812,49 @@ exports[` 'Starts' tab matches snapshot 1`] = `
8
9
10
11
12
13
14
@@ -814,42 +863,49 @@ exports[` 'Starts' tab matches snapshot 1`] = `
15
16
17
18
19
20
21
@@ -858,42 +914,49 @@ exports[` 'Starts' tab matches snapshot 1`] = `
22
23
24
25
26
27
28
@@ -902,42 +965,49 @@ exports[` 'Starts' tab matches snapshot 1`] = `
29
1
2
3
4
5
6
diff --git a/ui/src/Components/SilenceModal/DateTimeSelect/index.test.js b/ui/src/Components/SilenceModal/DateTimeSelect/index.test.js index 7111aa412..3f0b8b5f3 100644 --- a/ui/src/Components/SilenceModal/DateTimeSelect/index.test.js +++ b/ui/src/Components/SilenceModal/DateTimeSelect/index.test.js @@ -162,22 +162,19 @@ const ValidateTimeButton = ( expect(diffMS).toBe(expectedDiff); }; -const ShallowTabContentStart = () => { - return shallow(); -}; - const MountedTabContentStart = () => { return mount(); }; describe("", () => { it("selecting date on DatePicker updates startsAt", () => { - const tree = ShallowTabContentStart(); - const picker = tree.find("DatePicker"); - const startsAt = moment([2063, 10, 10, 0, 1, 2]); - picker.simulate("change", startsAt); + const tree = MountedTabContentStart(); expect(silenceFormStore.data.startsAt.toISOString()).toBe( - startsAt.toISOString() + moment([2060, 1, 1, 0, 0, 0]).toISOString() + ); + tree.find("div.react-datepicker__day--018").simulate("click"); + expect(silenceFormStore.data.startsAt.toISOString()).toBe( + moment([2060, 1, 18, 0, 0, 0]).toISOString() ); }); @@ -202,22 +199,19 @@ describe("", () => { }); }); -const ShallowTabContentEnd = () => { - return shallow(); -}; - const MountedTabContentEnd = () => { return mount(); }; describe("", () => { it("Selecting date on DatePicker updates endsAt", () => { - const tree = ShallowTabContentEnd(); - const picker = tree.find("DatePicker"); - const endsAt = moment([2063, 11, 5, 1, 3, 2]); - picker.simulate("change", endsAt); + const tree = MountedTabContentEnd(); expect(silenceFormStore.data.endsAt.toISOString()).toBe( - endsAt.toISOString() + moment([2061, 1, 1, 0, 0, 0]).toISOString() + ); + tree.find("div.react-datepicker__day--024").simulate("click"); + expect(silenceFormStore.data.endsAt.toISOString()).toBe( + moment([2061, 1, 24, 0, 0, 0]).toISOString() ); });