From 077ca3e17d7c92788d79632cba4bae25cabbeb85 Mon Sep 17 00:00:00 2001 From: oh3vci Date: Mon, 14 Sep 2020 19:20:46 +0900 Subject: [PATCH] fix: the test parts set value to new Date() when there is no prop --- main/__tests__/DatePicker.test.tsx | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/main/__tests__/DatePicker.test.tsx b/main/__tests__/DatePicker.test.tsx index 0f687a9b8..09b6c2575 100644 --- a/main/__tests__/DatePicker.test.tsx +++ b/main/__tests__/DatePicker.test.tsx @@ -15,11 +15,11 @@ import { TouchableOpacity } from 'react-native'; import { render } from '@testing-library/react-native'; import renderer from 'react-test-renderer'; -const standardDate = new Date('2020-09-01'); +const standardDate = new Date('2020-09-13'); describe('[DatePicker] render', () => { it('should render without crashing', () => { - const rendered = render().asJSON(); + const rendered = render().asJSON(); // expect(rendered).toMatchSnapshot(); expect(rendered).toBeTruthy(); @@ -29,7 +29,7 @@ describe('[DatePicker] render', () => { describe('[DateInput] render', () => { it('should render without crashing', () => { const rendered = render( - {}} />, + {}} selectedDate={standardDate} />, ).asJSON(); // expect(rendered).toMatchSnapshot(); @@ -39,7 +39,7 @@ describe('[DateInput] render', () => { it('should simulate onPress', () => { const onPressCalendar = jest.fn(); const rendered = renderer.create( - , + , { createNodeMock: () => { return { @@ -63,7 +63,11 @@ describe('[DateInput] render', () => { describe('[PickerCalendar] render', () => { it('should render without crashing', () => { const rendered = render( - {}} />, + {}} + selectedDate={standardDate} + weekdayFormat={'narrow'} />, ).asJSON(); // expect(rendered).toMatchSnapshot(); @@ -75,8 +79,9 @@ describe('[Calendar]', () => { it('should render without crashing', () => { const rendered = render( } calendarWidth={300} - renderDay={() => } />, ).asJSON(); @@ -88,7 +93,7 @@ describe('[Calendar]', () => { describe('[CalendarDate] render', () => { it('should render without crashing', () => { const rendered = render( - {}} date={standardDate} />, + {}} date={standardDate} isToday={false} />, ).asJSON(); // expect(rendered).toMatchSnapshot(); @@ -99,7 +104,7 @@ describe('[CalendarDate] render', () => { it('should simulate onPress', () => { const onSelectDate = jest.fn(); const rendered = renderer.create( - , + , { createNodeMock: () => { return { @@ -126,8 +131,8 @@ describe('[CalendarMonth] render', () => { } - today={new Date(standardDate)} + renderDay={() => } + today={standardDate} />, ).asJSON();