mirror of
https://github.com/grafana/grafana.git
synced 2025-02-12 16:45:43 -06:00
* AccessControl: add one-dimensional permissions to datasources in the backend * AccessControl: add one-dimensional permissions to datasources in the frontend (#38080) Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com>
42 lines
815 B
TypeScript
42 lines
815 B
TypeScript
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();
|
|
});
|
|
});
|