mirror of
https://github.com/grafana/grafana.git
synced 2025-02-14 01:23:32 -06:00
47f8717149
* update eslint, tsconfig + esbuild to handle new jsx transform * remove thing that breaks the new jsx transform * remove react imports * adjust grafana-icons build * is this the correct syntax? * try this * well this was much easier than expected... * change grafana-plugin-configs webpack config * fixes * fix lockfile * fix 2 more violations * use path.resolve instead of require.resolve * remove react import * fix react imports * more fixes * remove React import * remove import React from docs * remove another react import
65 lines
1.5 KiB
TypeScript
65 lines
1.5 KiB
TypeScript
import { render } from '@testing-library/react';
|
|
import { Provider } from 'react-redux';
|
|
import { mockToolkitActionCreator } from 'test/core/redux/mocks';
|
|
|
|
import { configureStore } from 'app/store/configureStore';
|
|
import { Invitee, OrgUser } from 'app/types';
|
|
|
|
import { Props, UsersListPageUnconnected } from './UsersListPage';
|
|
import { pageChanged, sortChanged } from './state/reducers';
|
|
|
|
jest.mock('../../core/app_events', () => ({
|
|
emit: jest.fn(),
|
|
}));
|
|
|
|
jest.mock('app/core/core', () => ({
|
|
contextSrv: {
|
|
user: { orgId: 1 },
|
|
hasPermission: () => false,
|
|
licensedAccessControlEnabled: () => false,
|
|
},
|
|
}));
|
|
|
|
const setup = (propOverrides?: object) => {
|
|
const store = configureStore();
|
|
const props: Props = {
|
|
users: [] as OrgUser[],
|
|
invitees: [] as Invitee[],
|
|
searchQuery: '',
|
|
page: 1,
|
|
totalPages: 1,
|
|
perPage: 30,
|
|
externalUserMngInfo: '',
|
|
fetchInvitees: jest.fn(),
|
|
loadUsers: jest.fn(),
|
|
updateUser: jest.fn(),
|
|
removeUser: jest.fn(),
|
|
changePage: mockToolkitActionCreator(pageChanged),
|
|
changeSort: mockToolkitActionCreator(sortChanged),
|
|
isLoading: false,
|
|
rolesLoading: false,
|
|
};
|
|
|
|
Object.assign(props, propOverrides);
|
|
|
|
render(
|
|
<Provider store={store}>
|
|
<UsersListPageUnconnected {...props} />
|
|
</Provider>
|
|
);
|
|
};
|
|
|
|
describe('Render', () => {
|
|
it('should render component', () => {
|
|
expect(setup).not.toThrow();
|
|
});
|
|
|
|
it('should render List page', () => {
|
|
expect(() =>
|
|
setup({
|
|
hasFetched: true,
|
|
})
|
|
).not.toThrow();
|
|
});
|
|
});
|