mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-13 02:53:47 +00:00
Updated tests from modified code
This commit is contained in:
@@ -6,6 +6,7 @@ import reducer, {
|
||||
} from '../../../src/short-urls/reducers/shortUrlsList';
|
||||
import { SHORT_URL_TAGS_EDITED } from '../../../src/short-urls/reducers/shortUrlTags';
|
||||
import { SHORT_URL_DELETED } from '../../../src/short-urls/reducers/shortUrlDeletion';
|
||||
import { SHORT_URL_META_EDITED } from '../../../src/short-urls/reducers/shortUrlMeta';
|
||||
|
||||
describe('shortUrlsListReducer', () => {
|
||||
describe('reducer', () => {
|
||||
@@ -52,6 +53,31 @@ describe('shortUrlsListReducer', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('Updates meta on matching URL on SHORT_URL_META_EDITED', () => {
|
||||
const shortCode = 'abc123';
|
||||
const meta = {
|
||||
maxVisits: 5,
|
||||
validSince: '2020-05-05',
|
||||
};
|
||||
const state = {
|
||||
shortUrls: {
|
||||
data: [
|
||||
{ shortCode, meta: { maxVisits: 10 } },
|
||||
{ shortCode: 'foo', meta: null },
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
expect(reducer(state, { type: SHORT_URL_META_EDITED, shortCode, meta })).toEqual({
|
||||
shortUrls: {
|
||||
data: [
|
||||
{ shortCode, meta },
|
||||
{ shortCode: 'foo', meta: null },
|
||||
],
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('Removes matching URL on SHORT_URL_DELETED', () => {
|
||||
const shortCode = 'abc123';
|
||||
const state = {
|
||||
|
||||
Reference in New Issue
Block a user