Migrated tag actions to have a single DTO param

This commit is contained in:
Alejandro Celaya
2022-11-07 21:57:01 +01:00
parent f8fc1245ca
commit 648744f440
4 changed files with 14 additions and 23 deletions

View File

@@ -50,7 +50,7 @@ describe('tagEditReducer', () => {
describe('tagEdited', () => {
it('returns action based on provided params', () =>
expect(tagEdited('foo', 'bar', '#ff0000')).toEqual({
expect(tagEdited({ oldName: 'foo', newName: 'bar', color: '#ff0000' })).toEqual({
type: TAG_EDITED,
payload: {
oldName: 'foo',
@@ -74,7 +74,7 @@ describe('tagEditReducer', () => {
it('calls API on success', async () => {
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);
@@ -95,7 +95,7 @@ describe('tagEditReducer', () => {
it('throws on error', async () => {
const error = 'Error';
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);