You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
815 B
41 lines
815 B
import React from 'react';
|
|
import { shallow } from 'enzyme';
|
|
import ButtonRow, { Props } from './ButtonRow';
|
|
|
|
jest.mock('app/core/core', () => {
|
|
return {
|
|
contextSrv: {
|
|
hasPermission: () => true,
|
|
},
|
|
};
|
|
});
|
|
|
|
const setup = (propOverrides?: object) => {
|
|
const props: Props = {
|
|
isReadOnly: true,
|
|
onSubmit: jest.fn(),
|
|
onDelete: jest.fn(),
|
|
onTest: jest.fn(),
|
|
exploreUrl: '/explore',
|
|
};
|
|
|
|
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();
|
|
});
|
|
});
|
|
|