mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-01 05:06:39 +00:00
Migrated editTag and tagEdited actions to use payload
This commit is contained in:
@@ -35,7 +35,10 @@ describe('tagEditReducer', () => {
|
||||
});
|
||||
|
||||
it('returns tag names on EDIT_TAG', () => {
|
||||
expect(reducer(undefined, { type: EDIT_TAG, oldName, newName, color })).toEqual({
|
||||
expect(reducer(undefined, {
|
||||
type: EDIT_TAG,
|
||||
payload: { oldName, newName, color },
|
||||
})).toEqual({
|
||||
editing: false,
|
||||
edited: true,
|
||||
error: false,
|
||||
@@ -49,9 +52,11 @@ describe('tagEditReducer', () => {
|
||||
it('returns action based on provided params', () =>
|
||||
expect(tagEdited('foo', 'bar', '#ff0000')).toEqual({
|
||||
type: TAG_EDITED,
|
||||
oldName: 'foo',
|
||||
newName: 'bar',
|
||||
color: '#ff0000',
|
||||
payload: {
|
||||
oldName: 'foo',
|
||||
newName: 'bar',
|
||||
color: '#ff0000',
|
||||
},
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -81,7 +86,10 @@ describe('tagEditReducer', () => {
|
||||
|
||||
expect(dispatch).toHaveBeenCalledTimes(2);
|
||||
expect(dispatch).toHaveBeenNthCalledWith(1, { type: EDIT_TAG_START });
|
||||
expect(dispatch).toHaveBeenNthCalledWith(2, { type: EDIT_TAG, oldName, newName, color });
|
||||
expect(dispatch).toHaveBeenNthCalledWith(2, {
|
||||
type: EDIT_TAG,
|
||||
payload: { oldName, newName, color },
|
||||
});
|
||||
});
|
||||
|
||||
it('throws on error', async () => {
|
||||
|
||||
@@ -60,7 +60,13 @@ describe('tagsListReducer', () => {
|
||||
const newName = 'renamed';
|
||||
const expectedTags = ['foo', 'renamed', 'baz'].sort();
|
||||
|
||||
expect(reducer(state({ tags, filteredTags: tags }), { type: TAG_EDITED, oldName, newName } as any)).toEqual({
|
||||
expect(reducer(
|
||||
state({ tags, filteredTags: tags }),
|
||||
{
|
||||
type: TAG_EDITED,
|
||||
payload: { oldName, newName },
|
||||
} as any,
|
||||
)).toEqual({
|
||||
tags: expectedTags,
|
||||
filteredTags: expectedTags,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user