Extracted tag related services to its own service provider

This commit is contained in:
Alejandro Celaya
2018-12-18 14:54:54 +01:00
parent fa3e1eba93
commit 566322a8c5
7 changed files with 68 additions and 59 deletions

View File

@@ -5,7 +5,7 @@ import reducer, {
DELETE_TAG,
TAG_DELETED,
tagDeleted,
_deleteTag,
deleteTag,
} from '../../../src/tags/reducers/tagDelete';
describe('tagDeleteReducer', () => {
@@ -56,7 +56,7 @@ describe('tagDeleteReducer', () => {
const expectedDispatchCalls = 2;
const tag = 'foo';
const apiClientMock = createApiClientMock(Promise.resolve());
const dispatchable = _deleteTag(() => apiClientMock, tag);
const dispatchable = deleteTag(() => apiClientMock)(tag);
await dispatchable(dispatch, getState);
@@ -73,7 +73,7 @@ describe('tagDeleteReducer', () => {
const error = 'Error';
const tag = 'foo';
const apiClientMock = createApiClientMock(Promise.reject(error));
const dispatchable = _deleteTag(() => apiClientMock, tag);
const dispatchable = deleteTag(() => apiClientMock)(tag);
try {
await dispatchable(dispatch, getState);

View File

@@ -5,7 +5,7 @@ import reducer, {
EDIT_TAG,
TAG_EDITED,
tagEdited,
_editTag,
editTag,
} from '../../../src/tags/reducers/tagEdit';
describe('tagEditReducer', () => {
@@ -68,7 +68,7 @@ describe('tagEditReducer', () => {
const newName = 'bar';
const color = '#ff0000';
const apiClientMock = createApiClientMock(Promise.resolve());
const dispatchable = _editTag(() => apiClientMock, colorGenerator, oldName, newName, color);
const dispatchable = editTag(() => apiClientMock, colorGenerator)(oldName, newName, color);
await dispatchable(dispatch, getState);
@@ -90,7 +90,7 @@ describe('tagEditReducer', () => {
const newName = 'bar';
const color = '#ff0000';
const apiClientMock = createApiClientMock(Promise.reject(error));
const dispatchable = _editTag(() => apiClientMock, colorGenerator, oldName, newName, color);
const dispatchable = editTag(() => apiClientMock, colorGenerator)(oldName, newName, color);
try {
await dispatchable(dispatch, getState);