mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
25 lines
793 B
TypeScript
25 lines
793 B
TypeScript
import { Action } from './actions';
|
|
import { OrgRole, PermissionLevel, DashboardState } from 'app/types';
|
|
import { initialState, dashboardReducer } from './reducers';
|
|
|
|
describe('dashboard reducer', () => {
|
|
describe('loadDashboardPermissions', () => {
|
|
let state: DashboardState;
|
|
|
|
beforeEach(() => {
|
|
const action: Action = {
|
|
type: 'LOAD_DASHBOARD_PERMISSIONS',
|
|
payload: [
|
|
{ id: 2, dashboardId: 1, role: OrgRole.Viewer, permission: PermissionLevel.View },
|
|
{ id: 3, dashboardId: 1, role: OrgRole.Editor, permission: PermissionLevel.Edit },
|
|
],
|
|
};
|
|
state = dashboardReducer(initialState, action);
|
|
});
|
|
|
|
it('should add permissions to state', async () => {
|
|
expect(state.permissions.length).toBe(2);
|
|
});
|
|
});
|
|
});
|