mirror of
https://github.com/grafana/grafana.git
synced 2025-02-09 23:16:16 -06:00
cff70b6648
* Migrate UsersActionBar * Invites table * Migrate Users page * Select version of OrgPicker * OrgRolePicker to use Select only * Fix modal issue * Move legacy Switch * Move from Forms folder * Fix failing test * Merge and fix issues * Update OrgRole issues * OrgUser type * Remove unused import * Update Snapshot
44 lines
1011 B
TypeScript
44 lines
1011 B
TypeScript
import React from 'react';
|
|
import { shallow } from 'enzyme';
|
|
import UsersTable, { Props } from './UsersTable';
|
|
import { OrgUser } from 'app/types';
|
|
import { getMockUsers } from './__mocks__/userMocks';
|
|
import { ConfirmModal } from '@grafana/ui';
|
|
|
|
const setup = (propOverrides?: object) => {
|
|
const props: Props = {
|
|
users: [] as OrgUser[],
|
|
onRoleChange: jest.fn(),
|
|
onRemoveUser: jest.fn(),
|
|
};
|
|
|
|
Object.assign(props, propOverrides);
|
|
|
|
return shallow(<UsersTable {...props} />);
|
|
};
|
|
|
|
describe('Render', () => {
|
|
it('should render component', () => {
|
|
const wrapper = setup();
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
});
|
|
|
|
it('should render users table', () => {
|
|
const wrapper = setup({
|
|
users: getMockUsers(5),
|
|
});
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
});
|
|
});
|
|
|
|
describe('Remove modal', () => {
|
|
it('should render correct amount', () => {
|
|
const wrapper = setup({
|
|
users: getMockUsers(3),
|
|
});
|
|
expect(wrapper.find(ConfirmModal).length).toEqual(4);
|
|
});
|
|
});
|