17018: Fixes the bug adding checks for readonly context menu type.
[arvados-workbench2.git] / src / views-components / context-menu / actions / file-viewer-action.test.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import * as React from 'react';
6 import { shallow, configure } from 'enzyme';
7 import * as Adapter from 'enzyme-adapter-react-16';
8 import { FileViewerAction } from './file-viewer-action';
9
10 configure({ adapter: new Adapter() });
11
12 describe('FileViewerAction', () => {
13     let props;
14
15     beforeEach(() => {
16         props = {
17             onClick: jest.fn(),
18             href: 'https://collections.ardev.roche.com/c=ardev-4zz18-k0hamvtwyit6q56/t=1ha4ykd3w14ed19b2gh3uyjrjup38vsx27x1utwdne0bxcfg5d/LIMS/1.html',
19         };
20     });
21
22     it('should render properly and handle click', () => {
23         // when
24         const wrapper = shallow(<FileViewerAction {...props} />);
25         wrapper.find('a').simulate('click');
26
27         // then
28         expect(wrapper).not.toBeUndefined();
29
30         // and
31         expect(props.onClick).toHaveBeenCalled();
32     });
33 });