From e177d0ac64fbcc14e15c352fc81b4e22544dbd48 Mon Sep 17 00:00:00 2001 From: Wojciech Maj Date: Thu, 16 Jan 2020 21:54:29 +0100 Subject: [PATCH] Change mount() to shallow() in tests --- src/Calendar.spec.jsx | 48 +++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/Calendar.spec.jsx b/src/Calendar.spec.jsx index ba792ee7..e050f530 100644 --- a/src/Calendar.spec.jsx +++ b/src/Calendar.spec.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import { mount, shallow } from 'enzyme'; +import { shallow } from 'enzyme'; import { getMonthStart } from '@wojtekmaj/date-utils'; import Calendar from './Calendar'; @@ -47,7 +47,7 @@ describe('Calendar', () => { }); it('renders YearView when given view = "year"', () => { - const component = mount( + const component = shallow( , ); @@ -57,7 +57,7 @@ describe('Calendar', () => { }); it('renders DecadeView when given view = "decade"', () => { - const component = mount( + const component = shallow( , ); @@ -67,7 +67,7 @@ describe('Calendar', () => { }); it('renders CenturyView when given view = "century"', () => { - const component = mount( + const component = shallow( , ); @@ -253,7 +253,7 @@ describe('Calendar', () => { describe('handles drill up properly', () => { it('drills up when allowed', () => { - const component = mount( + const component = shallow( , ); @@ -265,7 +265,7 @@ describe('Calendar', () => { it('calls onDrillUp on drill up', () => { const onDrillUp = jest.fn(); - const component = mount( + const component = shallow( { it('refuses to drill up when already on minimum allowed detail', () => { const onDrillUp = jest.fn(); - const component = mount( + const component = shallow( { describe('handles drill down properly', () => { it('drills down when allowed', () => { - const component = mount( + const component = shallow( , ); @@ -311,7 +311,7 @@ describe('Calendar', () => { it('calls onDrillDown on drill down', () => { const onDrillDown = jest.fn(); - const component = mount( + const component = shallow( { it('refuses to drill down when already on minimum allowed detail', () => { const onDrillDown = jest.fn(); - const component = mount( + const component = shallow( { describe('handles active start date change properly', () => { it('changes active start date when allowed', () => { - const component = mount( + const component = shallow( , ); @@ -358,7 +358,7 @@ describe('Calendar', () => { const activeStartDate = new Date(2017, 0, 1); const newActiveStartDate = new Date(2018, 0, 1); const onActiveStartDateChange = jest.fn(); - const component = mount( + const component = shallow( { describe('calls onChange properly', () => { it('calls onChange function returning the beginning of selected period by default', () => { const onChange = jest.fn(); - const component = mount( + const component = shallow( { it('calls onChange function returning the beginning of the selected period when returnValue is set to "start"', () => { const onChange = jest.fn(); - const component = mount( + const component = shallow( { it('calls onChange function returning the beginning of the selected period when returnValue is set to "start"', () => { const onChange = jest.fn(); - const component = mount( + const component = shallow( { it('calls onChange function returning the end of the selected period when returnValue is set to "end"', () => { const onChange = jest.fn(); - const component = mount( + const component = shallow( { it('calls onChange function returning the beginning of selected period when returnValue is set to "range"', () => { const onChange = jest.fn(); - const component = mount( + const component = shallow( { it('calls onChange function returning the beginning of selected period, but no earlier than minDate', () => { const onChange = jest.fn(); - const component = mount( + const component = shallow( { it('calls onChange function returning the beginning of selected period, but no later than maxDate', () => { const onChange = jest.fn(); - const component = mount( + const component = shallow( { it('calls onChange function returning the end of selected period, but no earlier than minDate', () => { const onChange = jest.fn(); - const component = mount( + const component = shallow( { it('calls onChange function returning the end of selected period, but no later than maxDate', () => { const onChange = jest.fn(); - const component = mount( + const component = shallow( { it('calls onChange function returning a range when selected two pieces of a range', () => { const onChange = jest.fn(); - const component = mount( + const component = shallow( { it('calls onChange function returning a range when selected reversed two pieces of a range', () => { const onChange = jest.fn(); - const component = mount( + const component = shallow( { it('changes Calendar view given new activeStartDate value', () => { const activeStartDate = new Date(2017, 0, 1); const newActiveStartDate = new Date(2018, 0, 1); - const component = mount( + const component = shallow( , );