Fixed typo

This commit is contained in:
Alejandro Celaya 2018-08-26 10:52:45 +02:00
parent c0e116b17b
commit 3569202a62
4 changed files with 15 additions and 15 deletions

View file

@ -19,7 +19,7 @@ const defaultState = {
error: false,
};
export default function reduce(state = defaultState, action) {
export default function reducer(state = defaultState, action) {
switch (action.type) {
case DELETE_TAG_START:
return {

View file

@ -1,5 +1,5 @@
import * as sinon from 'sinon';
import reduce, {
import reducer, {
_selectServer,
RESET_SELECTED_SERVER,
resetSelectedServer,
@ -8,17 +8,17 @@ import reduce, {
import { RESET_SHORT_URL_PARAMS } from '../../../src/short-urls/reducers/shortUrlsListParams';
describe('selectedServerReducer', () => {
describe('reduce', () => {
describe('reducer', () => {
it('returns default when action is not handled', () =>
expect(reduce(null, { type: 'unknown' })).toEqual(null));
expect(reducer(null, { type: 'unknown' })).toEqual(null));
it('returns default when action is RESET_SELECTED_SERVER', () =>
expect(reduce(null, { type: RESET_SELECTED_SERVER })).toEqual(null));
expect(reducer(null, { type: RESET_SELECTED_SERVER })).toEqual(null));
it('returns selected server when action is SELECT_SERVER', () => {
const selectedServer = { id: 'abc123' };
expect(reduce(null, { type: SELECT_SERVER, selectedServer })).toEqual(selectedServer);
expect(reducer(null, { type: SELECT_SERVER, selectedServer })).toEqual(selectedServer);
});
});

View file

@ -1,6 +1,6 @@
import * as sinon from 'sinon';
import { values } from 'ramda';
import reduce, {
import reducer, {
_createServer,
_deleteServer,
_listServers,
@ -20,12 +20,12 @@ describe('serverReducer', () => {
createServers: sinon.fake(),
};
describe('reduce', () => {
describe('reducer', () => {
it('returns servers when action is FETCH_SERVERS', () =>
expect(reduce({}, { type: FETCH_SERVERS, servers })).toEqual(servers));
expect(reducer({}, { type: FETCH_SERVERS, servers })).toEqual(servers));
it('returns default when action is unknown', () =>
expect(reduce({}, { type: 'unknown' })).toEqual({}));
expect(reducer({}, { type: 'unknown' })).toEqual({}));
});
describe('action creators', () => {

View file

@ -1,24 +1,24 @@
import reduce, {
import reducer, {
RESET_SHORT_URL_PARAMS,
resetShortUrlParams,
} from '../../../src/short-urls/reducers/shortUrlsListParams';
import { LIST_SHORT_URLS } from '../../../src/short-urls/reducers/shortUrlsList';
describe('shortUrlsListParamsReducer', () => {
describe('reducer', () => {
describe('reducerr', () => {
const defaultState = { page: '1' };
it('returns default value when action is unknown', () =>
expect(reduce(defaultState, { type: 'unknown' })).toEqual(defaultState));
expect(reducer(defaultState, { type: 'unknown' })).toEqual(defaultState));
it('returns params when action is LIST_SHORT_URLS', () =>
expect(reduce(defaultState, { type: LIST_SHORT_URLS, params: { searchTerm: 'foo' } })).toEqual({
expect(reducer(defaultState, { type: LIST_SHORT_URLS, params: { searchTerm: 'foo' } })).toEqual({
...defaultState,
searchTerm: 'foo',
}));
it('returns default value when action is RESET_SHORT_URL_PARAMS', () =>
expect(reduce(defaultState, { type: RESET_SHORT_URL_PARAMS })).toEqual(defaultState));
expect(reducer(defaultState, { type: RESET_SHORT_URL_PARAMS })).toEqual(defaultState));
});
describe('resetShortUrlParams', () => {