Improved short URL creation

This commit is contained in:
Alejandro Celaya
2020-04-10 18:42:08 +02:00
parent eb65e99024
commit 2a2bae6d1a
4 changed files with 34 additions and 23 deletions

View File

@@ -11,7 +11,7 @@ describe('<CreateShortUrl />', () => {
const shortUrlCreationResult = {
loading: false,
};
const createShortUrl = jest.fn();
const createShortUrl = jest.fn(() => Promise.resolve());
beforeEach(() => {
const CreateShortUrl = createShortUrlsCreator(TagsSelector, () => '', () => '');
@@ -22,7 +22,7 @@ describe('<CreateShortUrl />', () => {
});
afterEach(() => {
wrapper.unmount();
createShortUrl.mockReset();
createShortUrl.mockClear();
});
it('saves short URL with data set in form controls', () => {

View File

@@ -72,6 +72,8 @@ describe('shortUrlCreationReducer', () => {
const apiClientMock = createApiClientMock(Promise.reject(error));
const dispatchable = createShortUrl(() => apiClientMock)({});
expect.assertions(5);
try {
await dispatchable(dispatch, getState);
} catch (e) {