|
|
@@ -2,17 +2,15 @@ import React from 'react';
|
|
|
import { shallow } from 'enzyme';
|
|
|
import { DashboardRow } from '../dashgrid/DashboardRow';
|
|
|
import { PanelModel } from '../panel_model';
|
|
|
-import config from '../../../core/config';
|
|
|
|
|
|
describe('DashboardRow', () => {
|
|
|
let wrapper, panel, getPanelContainer, dashboardMock;
|
|
|
|
|
|
beforeEach(() => {
|
|
|
- dashboardMock = { toggleRow: jest.fn() };
|
|
|
-
|
|
|
- config.bootData = {
|
|
|
- user: {
|
|
|
- orgRole: 'Admin',
|
|
|
+ dashboardMock = {
|
|
|
+ toggleRow: jest.fn(),
|
|
|
+ meta: {
|
|
|
+ canEdit: true,
|
|
|
},
|
|
|
};
|
|
|
|
|
|
@@ -41,8 +39,8 @@ describe('DashboardRow', () => {
|
|
|
expect(wrapper.find('.dashboard-row__actions .pointer')).toHaveLength(2);
|
|
|
});
|
|
|
|
|
|
- it('should have zero actions as viewer', () => {
|
|
|
- config.bootData.user.orgRole = 'Viewer';
|
|
|
+ it('should have zero actions when cannot edit', () => {
|
|
|
+ dashboardMock.meta.canEdit = false;
|
|
|
panel = new PanelModel({ collapsed: false });
|
|
|
wrapper = shallow(<DashboardRow panel={panel} getPanelContainer={getPanelContainer} />);
|
|
|
expect(wrapper.find('.dashboard-row__actions .pointer')).toHaveLength(0);
|