2018-11-01 07:45:52 -05:00
|
|
|
import React from 'react';
|
|
|
|
import { shallow } from 'enzyme';
|
|
|
|
import ButtonRow, { Props } from './ButtonRow';
|
|
|
|
|
2021-09-01 08:18:17 -05:00
|
|
|
jest.mock('app/core/core', () => {
|
|
|
|
return {
|
|
|
|
contextSrv: {
|
|
|
|
hasPermission: () => true,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2018-11-01 07:45:52 -05:00
|
|
|
const setup = (propOverrides?: object) => {
|
|
|
|
const props: Props = {
|
|
|
|
isReadOnly: true,
|
|
|
|
onSubmit: jest.fn(),
|
|
|
|
onDelete: jest.fn(),
|
2019-02-12 01:45:21 -06:00
|
|
|
onTest: jest.fn(),
|
2021-08-23 10:23:49 -05:00
|
|
|
exploreUrl: '/explore',
|
2018-11-01 07:45:52 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
Object.assign(props, propOverrides);
|
|
|
|
|
|
|
|
return shallow(<ButtonRow {...props} />);
|
|
|
|
};
|
|
|
|
|
|
|
|
describe('Render', () => {
|
|
|
|
it('should render component', () => {
|
|
|
|
const wrapper = setup();
|
|
|
|
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render with buttons enabled', () => {
|
|
|
|
const wrapper = setup({
|
|
|
|
isReadOnly: false,
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
});
|