Skip to content

Commit 3257f3a

Browse files
authored
refactor: use shallow to fix react warning (#1236)
Switcher test (`src\tests\unit\tests\DetailsView\components\switcher.test.tsx`) is showing warnings (while running the unit tests): **componentWillRecieveProps has been renamed...** The warning mention to update `DropdownBase` which is on the office fabric side (one more reason to update our office ui fabric version) but we can fix this warning by not `mount`ing the tested component. Instead, we can use `shallow` which will not call to the base component.
1 parent afb1cfc commit 3257f3a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/tests/unit/tests/DetailsView/components/switcher.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
3-
import { mount, shallow } from 'enzyme';
3+
import { shallow } from 'enzyme';
44
import { Dropdown, IDropdownOption } from 'office-ui-fabric-react/lib/Dropdown';
55
import * as React from 'react';
66
import { IMock, Mock, Times } from 'typemoq';
@@ -40,7 +40,7 @@ describe('Switcher', () => {
4040
actionCreatorMock
4141
.setup(creator => creator.sendPivotItemClicked(DetailsViewPivotType[DetailsViewPivotType.assessment]))
4242
.verifiable(Times.once());
43-
const wrapper = mount<Switcher>(<Switcher {...defaultProps} />);
43+
const wrapper = shallow<Switcher>(<Switcher {...defaultProps} />);
4444
const dropdown = wrapper.find(Dropdown);
4545

4646
expect(wrapper.state().selectedKey).toBe(DetailsViewPivotType.fastPass);

0 commit comments

Comments
 (0)