Skip to content

Commit e177d0a

Browse files
committed
Change mount() to shallow() in tests
1 parent 058aeb2 commit e177d0a

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

src/Calendar.spec.jsx

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { mount, shallow } from 'enzyme';
2+
import { shallow } from 'enzyme';
33
import { getMonthStart } from '@wojtekmaj/date-utils';
44

55
import Calendar from './Calendar';
@@ -47,7 +47,7 @@ describe('Calendar', () => {
4747
});
4848

4949
it('renders YearView when given view = "year"', () => {
50-
const component = mount(
50+
const component = shallow(
5151
<Calendar view="year" />,
5252
);
5353

@@ -57,7 +57,7 @@ describe('Calendar', () => {
5757
});
5858

5959
it('renders DecadeView when given view = "decade"', () => {
60-
const component = mount(
60+
const component = shallow(
6161
<Calendar view="decade" />,
6262
);
6363

@@ -67,7 +67,7 @@ describe('Calendar', () => {
6767
});
6868

6969
it('renders CenturyView when given view = "century"', () => {
70-
const component = mount(
70+
const component = shallow(
7171
<Calendar view="century" />,
7272
);
7373

@@ -253,7 +253,7 @@ describe('Calendar', () => {
253253

254254
describe('handles drill up properly', () => {
255255
it('drills up when allowed', () => {
256-
const component = mount(
256+
const component = shallow(
257257
<Calendar view="month" />,
258258
);
259259

@@ -265,7 +265,7 @@ describe('Calendar', () => {
265265
it('calls onDrillUp on drill up', () => {
266266
const onDrillUp = jest.fn();
267267

268-
const component = mount(
268+
const component = shallow(
269269
<Calendar
270270
activeStartDate={new Date(2017, 6, 1)}
271271
onDrillUp={onDrillUp}
@@ -284,7 +284,7 @@ describe('Calendar', () => {
284284
it('refuses to drill up when already on minimum allowed detail', () => {
285285
const onDrillUp = jest.fn();
286286

287-
const component = mount(
287+
const component = shallow(
288288
<Calendar
289289
onDrillUp={onDrillUp}
290290
view="century"
@@ -299,7 +299,7 @@ describe('Calendar', () => {
299299

300300
describe('handles drill down properly', () => {
301301
it('drills down when allowed', () => {
302-
const component = mount(
302+
const component = shallow(
303303
<Calendar view="century" />,
304304
);
305305

@@ -311,7 +311,7 @@ describe('Calendar', () => {
311311
it('calls onDrillDown on drill down', () => {
312312
const onDrillDown = jest.fn();
313313

314-
const component = mount(
314+
const component = shallow(
315315
<Calendar
316316
activeStartDate={new Date(2001, 0, 1)}
317317
onDrillDown={onDrillDown}
@@ -330,7 +330,7 @@ describe('Calendar', () => {
330330
it('refuses to drill down when already on minimum allowed detail', () => {
331331
const onDrillDown = jest.fn();
332332

333-
const component = mount(
333+
const component = shallow(
334334
<Calendar
335335
onDrillDown={onDrillDown}
336336
view="month"
@@ -345,7 +345,7 @@ describe('Calendar', () => {
345345

346346
describe('handles active start date change properly', () => {
347347
it('changes active start date when allowed', () => {
348-
const component = mount(
348+
const component = shallow(
349349
<Calendar />,
350350
);
351351

@@ -358,7 +358,7 @@ describe('Calendar', () => {
358358
const activeStartDate = new Date(2017, 0, 1);
359359
const newActiveStartDate = new Date(2018, 0, 1);
360360
const onActiveStartDateChange = jest.fn();
361-
const component = mount(
361+
const component = shallow(
362362
<Calendar
363363
activeStartDate={activeStartDate}
364364
onActiveStartDateChange={onActiveStartDateChange}
@@ -378,7 +378,7 @@ describe('Calendar', () => {
378378
describe('calls onChange properly', () => {
379379
it('calls onChange function returning the beginning of selected period by default', () => {
380380
const onChange = jest.fn();
381-
const component = mount(
381+
const component = shallow(
382382
<Calendar
383383
onChange={onChange}
384384
view="month"
@@ -392,7 +392,7 @@ describe('Calendar', () => {
392392

393393
it('calls onChange function returning the beginning of the selected period when returnValue is set to "start"', () => {
394394
const onChange = jest.fn();
395-
const component = mount(
395+
const component = shallow(
396396
<Calendar
397397
onChange={onChange}
398398
returnValue="start"
@@ -407,7 +407,7 @@ describe('Calendar', () => {
407407

408408
it('calls onChange function returning the beginning of the selected period when returnValue is set to "start"', () => {
409409
const onChange = jest.fn();
410-
const component = mount(
410+
const component = shallow(
411411
<Calendar
412412
onChange={onChange}
413413
returnValue="start"
@@ -422,7 +422,7 @@ describe('Calendar', () => {
422422

423423
it('calls onChange function returning the end of the selected period when returnValue is set to "end"', () => {
424424
const onChange = jest.fn();
425-
const component = mount(
425+
const component = shallow(
426426
<Calendar
427427
onChange={onChange}
428428
returnValue="end"
@@ -437,7 +437,7 @@ describe('Calendar', () => {
437437

438438
it('calls onChange function returning the beginning of selected period when returnValue is set to "range"', () => {
439439
const onChange = jest.fn();
440-
const component = mount(
440+
const component = shallow(
441441
<Calendar
442442
onChange={onChange}
443443
returnValue="range"
@@ -455,7 +455,7 @@ describe('Calendar', () => {
455455

456456
it('calls onChange function returning the beginning of selected period, but no earlier than minDate', () => {
457457
const onChange = jest.fn();
458-
const component = mount(
458+
const component = shallow(
459459
<Calendar
460460
minDate={new Date(2017, 0, 1, 12)}
461461
onChange={onChange}
@@ -471,7 +471,7 @@ describe('Calendar', () => {
471471

472472
it('calls onChange function returning the beginning of selected period, but no later than maxDate', () => {
473473
const onChange = jest.fn();
474-
const component = mount(
474+
const component = shallow(
475475
<Calendar
476476
maxDate={new Date(2017, 0, 1, 12)}
477477
onChange={onChange}
@@ -487,7 +487,7 @@ describe('Calendar', () => {
487487

488488
it('calls onChange function returning the end of selected period, but no earlier than minDate', () => {
489489
const onChange = jest.fn();
490-
const component = mount(
490+
const component = shallow(
491491
<Calendar
492492
minDate={new Date(2017, 0, 2, 12)}
493493
onChange={onChange}
@@ -503,7 +503,7 @@ describe('Calendar', () => {
503503

504504
it('calls onChange function returning the end of selected period, but no later than maxDate', () => {
505505
const onChange = jest.fn();
506-
const component = mount(
506+
const component = shallow(
507507
<Calendar
508508
maxDate={new Date(2017, 0, 1, 12)}
509509
onChange={onChange}
@@ -519,7 +519,7 @@ describe('Calendar', () => {
519519

520520
it('calls onChange function returning a range when selected two pieces of a range', () => {
521521
const onChange = jest.fn();
522-
const component = mount(
522+
const component = shallow(
523523
<Calendar
524524
onChange={onChange}
525525
selectRange
@@ -539,7 +539,7 @@ describe('Calendar', () => {
539539

540540
it('calls onChange function returning a range when selected reversed two pieces of a range', () => {
541541
const onChange = jest.fn();
542-
const component = mount(
542+
const component = shallow(
543543
<Calendar
544544
onChange={onChange}
545545
selectRange
@@ -561,7 +561,7 @@ describe('Calendar', () => {
561561
it('changes Calendar view given new activeStartDate value', () => {
562562
const activeStartDate = new Date(2017, 0, 1);
563563
const newActiveStartDate = new Date(2018, 0, 1);
564-
const component = mount(
564+
const component = shallow(
565565
<Calendar activeStartDate={activeStartDate} />,
566566
);
567567

0 commit comments

Comments
 (0)