mirror of
https://github.com/grafana/grafana.git
synced 2025-02-11 08:05:43 -06:00
34 lines
754 B
TypeScript
34 lines
754 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';
|
|
|
|
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();
|
|
});
|
|
});
|