1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import { Button } from '@material-ui/core';
7 import { mount, configure } from 'enzyme';
8 import * as Adapter from 'enzyme-adapter-react-16';
9 import * as CopyToClipboard from 'react-copy-to-clipboard';
10 import { CurrentTokenDialogComponent } from './current-token-dialog';
12 configure({ adapter: new Adapter() });
14 jest.mock('toggle-selection', () => () => () => null);
16 describe('<CurrentTokenDialog />', () => {
24 currentToken: '123123123123',
31 describe('copy to clipboard', () => {
33 wrapper = mount(<CurrentTokenDialogComponent {...props} />);
36 it('should copy API TOKEN to the clipboard', () => {
38 wrapper.find(CopyToClipboard).find(Button).simulate('click');
41 expect(props.dispatch).toHaveBeenCalledWith({
45 message: 'Token copied to clipboard',
47 type: 'OPEN_SNACKBAR',