-
Notifications
You must be signed in to change notification settings - Fork 145
/
report-export-button.test.tsx
38 lines (31 loc) · 1.15 KB
/
report-export-button.test.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { IButton } from '@fluentui/react';
import {
ReportExportButton,
ReportExportButtonProps,
} from 'DetailsView/components/report-export-button';
import { shallow } from 'enzyme';
import * as React from 'react';
import { IMock, Mock, Times } from 'typemoq';
describe(ReportExportButton.displayName, () => {
let showDialogMock: IMock<() => void>;
let props: ReportExportButtonProps;
beforeEach(() => {
showDialogMock = Mock.ofInstance(() => null);
props = {
showReportExportDialog: showDialogMock.object,
buttonRef: {} as React.RefObject<IButton>,
};
});
it('renders ReportExportButton', () => {
const wrapper = shallow(<ReportExportButton {...props} />);
expect(wrapper.getElement()).toMatchSnapshot();
});
it('shows export dialog on click', () => {
showDialogMock.setup(d => d()).verifiable(Times.once());
const wrapper = shallow(<ReportExportButton {...props} />);
wrapper.simulate('click');
showDialogMock.verifyAll();
});
});