Added flag on short URL creation which tells if the short URL was already saved

This commit is contained in:
Alejandro Celaya
2022-11-07 18:24:26 +01:00
parent ae1d39bede
commit 4ca31fc162
9 changed files with 23 additions and 19 deletions

View File

@@ -13,7 +13,7 @@ describe('<CreateShortUrl />', () => {
const CreateShortUrl = createShortUrlsCreator(ShortUrlForm, CreateShortUrlResult);
const setUp = () => render(
<CreateShortUrl
shortUrlCreationResult={shortUrlCreationResult}
shortUrlCreation={shortUrlCreationResult}
createShortUrl={createShortUrl}
selectedServer={null}
resetCreateShortUrl={() => {}}

View File

@@ -22,16 +22,16 @@ describe('shortUrlCreationReducer', () => {
it('returns loading on CREATE_SHORT_URL_START', () => {
expect(reducer(undefined, action(createShortUrl.pending.toString()))).toEqual({
result: null,
saving: true,
saved: false,
error: false,
});
});
it('returns error on CREATE_SHORT_URL_ERROR', () => {
expect(reducer(undefined, action(createShortUrl.rejected.toString()))).toEqual({
result: null,
saving: false,
saved: false,
error: true,
});
});
@@ -40,14 +40,15 @@ describe('shortUrlCreationReducer', () => {
expect(reducer(undefined, action(createShortUrl.fulfilled.toString(), { payload: shortUrl }))).toEqual({
result: shortUrl,
saving: false,
saved: true,
error: false,
});
});
it('returns default state on RESET_CREATE_SHORT_URL', () => {
expect(reducer(undefined, action(resetCreateShortUrl.toString()))).toEqual({
result: null,
saving: false,
saved: false,
error: false,
});
});