You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
981 B
27 lines
981 B
import { apiKeysLoaded, apiKeysReducer, initialApiKeysState, setSearchQuery } from './reducers';
|
|
import { getMultipleMockKeys } from '../__mocks__/apiKeysMock';
|
|
import { reducerTester } from '../../../../test/core/redux/reducerTester';
|
|
import { ApiKeysState } from '../../../types';
|
|
|
|
describe('API Keys reducer', () => {
|
|
it('should set keys', () => {
|
|
reducerTester<ApiKeysState>()
|
|
.givenReducer(apiKeysReducer, { ...initialApiKeysState })
|
|
.whenActionIsDispatched(apiKeysLoaded(getMultipleMockKeys(4)))
|
|
.thenStateShouldEqual({
|
|
...initialApiKeysState,
|
|
keys: getMultipleMockKeys(4),
|
|
hasFetched: true,
|
|
});
|
|
});
|
|
|
|
it('should set search query', () => {
|
|
reducerTester<ApiKeysState>()
|
|
.givenReducer(apiKeysReducer, { ...initialApiKeysState })
|
|
.whenActionIsDispatched(setSearchQuery('test query'))
|
|
.thenStateShouldEqual({
|
|
...initialApiKeysState,
|
|
searchQuery: 'test query',
|
|
});
|
|
});
|
|
});
|
|
|