mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-13 02:53:47 +00:00
Ensured state is reset on edit meta modal after closing it
This commit is contained in:
@@ -35,10 +35,7 @@ describe('<EditTagsModal />', () => {
|
||||
|
||||
afterEach(() => {
|
||||
wrapper && wrapper.unmount();
|
||||
editShortUrlTags.mockClear();
|
||||
shortUrlTagsEdited.mockReset();
|
||||
resetShortUrlsTags.mockReset();
|
||||
toggle.mockReset();
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
it('resets tags when component is mounted', () => {
|
||||
|
||||
@@ -3,7 +3,9 @@ import reducer, {
|
||||
EDIT_SHORT_URL_META_START,
|
||||
EDIT_SHORT_URL_META_ERROR,
|
||||
SHORT_URL_META_EDITED,
|
||||
RESET_EDIT_SHORT_URL_META,
|
||||
editShortUrlMeta,
|
||||
resetShortUrlMeta,
|
||||
} from '../../../src/short-urls/reducers/shortUrlMeta';
|
||||
|
||||
describe('shortUrlMetaReducer', () => {
|
||||
@@ -36,6 +38,15 @@ describe('shortUrlMetaReducer', () => {
|
||||
error: false,
|
||||
});
|
||||
});
|
||||
|
||||
it('goes back to initial state on RESET_EDIT_SHORT_URL_META', () => {
|
||||
expect(reducer({}, { type: RESET_EDIT_SHORT_URL_META })).toEqual({
|
||||
meta: {},
|
||||
shortCode: null,
|
||||
saving: false,
|
||||
error: false,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('editShortUrlMeta', () => {
|
||||
@@ -75,4 +86,8 @@ describe('shortUrlMetaReducer', () => {
|
||||
expect(dispatch).toHaveBeenNthCalledWith(2, { type: EDIT_SHORT_URL_META_ERROR });
|
||||
});
|
||||
});
|
||||
|
||||
describe('resetShortUrlMeta', () => {
|
||||
it('creates expected action', () => expect(resetShortUrlMeta()).toEqual({ type: RESET_EDIT_SHORT_URL_META }));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user