mirror of
https://github.com/grafana/grafana.git
synced 2026-09-05 04:40:13 -05:00
* Add auth labels and access control metadata to org users search results
* Fix search result JSON model
* Org users: Use API for pagination
* Fix default page size
* Refactor: UsersListPage to functional component
* Refactor: update UsersTable component code style
* Add pagination to the /orgs/{org_id}/users endpoint
* Use pagination on the AdminEditOrgPage
* Add /orgs/{org_id}/users/search endpoint to prevent breaking API
* Use existing search store method
* Remove unnecessary error
* Remove unused
* Add query param to search endpoint
* Fix endpoint docs
* Minor refactor
* Fix number of pages calculation
* Use SearchOrgUsers for all org users methods
* Refactor: GetOrgUsers as a service method
* Minor refactor: rename orgId => orgID
* Fix integration tests
* Fix tests
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { reducerTester } from '../../../../test/core/redux/reducerTester';
|
|
import { UsersState } from '../../../types';
|
|
import { getMockUsers, getFetchUsersMock } from '../__mocks__/userMocks';
|
|
|
|
import { initialState, searchQueryChanged, usersLoaded, usersReducer } from './reducers';
|
|
|
|
describe('usersReducer', () => {
|
|
describe('when usersLoaded is dispatched', () => {
|
|
it('then state should be correct', () => {
|
|
reducerTester<UsersState>()
|
|
.givenReducer(usersReducer, { ...initialState })
|
|
.whenActionIsDispatched(usersLoaded(getFetchUsersMock(1)))
|
|
.thenStateShouldEqual({
|
|
...initialState,
|
|
users: getMockUsers(1),
|
|
isLoading: true,
|
|
});
|
|
});
|
|
});
|
|
|
|
describe('when searchQueryChanged is dispatched', () => {
|
|
it('then state should be correct', () => {
|
|
reducerTester<UsersState>()
|
|
.givenReducer(usersReducer, { ...initialState })
|
|
.whenActionIsDispatched(searchQueryChanged('a query'))
|
|
.thenStateShouldEqual({
|
|
...initialState,
|
|
searchQuery: 'a query',
|
|
});
|
|
});
|
|
});
|
|
});
|