mirror of
https://github.com/grafana/grafana.git
synced 2025-02-09 23:16:16 -06:00
* 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
62 lines
1.4 KiB
TypeScript
62 lines
1.4 KiB
TypeScript
import React from 'react';
|
|
import { shallow } from 'enzyme';
|
|
import { Props, UsersListPage } from './UsersListPage';
|
|
import { Invitee, OrgUser } from 'app/types';
|
|
// import { getMockUser } from './__mocks__/userMocks';
|
|
import { NavModel } from '@grafana/data';
|
|
import { mockToolkitActionCreator } from 'test/core/redux/mocks';
|
|
import { setUsersSearchQuery } from './state/reducers';
|
|
|
|
jest.mock('../../core/app_events', () => ({
|
|
emit: jest.fn(),
|
|
}));
|
|
|
|
const setup = (propOverrides?: object) => {
|
|
const props: Props = {
|
|
navModel: {
|
|
main: {
|
|
text: 'Configuration',
|
|
},
|
|
node: {
|
|
text: 'Users',
|
|
},
|
|
} as NavModel,
|
|
users: [] as OrgUser[],
|
|
invitees: [] as Invitee[],
|
|
searchQuery: '',
|
|
externalUserMngInfo: '',
|
|
loadInvitees: jest.fn(),
|
|
loadUsers: jest.fn(),
|
|
updateUser: jest.fn(),
|
|
removeUser: jest.fn(),
|
|
setUsersSearchQuery: mockToolkitActionCreator(setUsersSearchQuery),
|
|
hasFetched: false,
|
|
};
|
|
|
|
Object.assign(props, propOverrides);
|
|
|
|
const wrapper = shallow(<UsersListPage {...props} />);
|
|
const instance = wrapper.instance() as UsersListPage;
|
|
|
|
return {
|
|
wrapper,
|
|
instance,
|
|
};
|
|
};
|
|
|
|
describe('Render', () => {
|
|
it('should render component', () => {
|
|
const { wrapper } = setup();
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
});
|
|
|
|
it('should render List page', () => {
|
|
const { wrapper } = setup({
|
|
hasFetched: true,
|
|
});
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
});
|
|
});
|