21700: Install Bundler system-wide in Rails postinst
[arvados.git] / services / workbench2 / 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 React from 'react';
6 import { shallow, configure } from 'enzyme';
7 import 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.example.com/c=zzzzz-4zz18-k0hamvtwyit6q56/t=xxxxxxx/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 });