Refactored editShortUrl action to require just one param

This commit is contained in:
Alejandro Celaya
2022-11-06 11:59:39 +01:00
parent bf84e4a2ed
commit 77cbb8ebc4
3 changed files with 12 additions and 9 deletions

View File

@@ -48,7 +48,7 @@ describe('shortUrlEditionReducer', () => {
afterEach(jest.clearAllMocks);
it.each([[undefined], [null], ['example.com']])('dispatches short URL on success', async (domain) => {
await editShortUrl(buildShlinkApiClient)(shortCode, domain, { longUrl })(dispatch, createGetState());
await editShortUrl(buildShlinkApiClient)({ shortCode, domain, data: { longUrl } })(dispatch, createGetState());
expect(buildShlinkApiClient).toHaveBeenCalledTimes(1);
expect(updateShortUrl).toHaveBeenCalledTimes(1);
@@ -64,7 +64,7 @@ describe('shortUrlEditionReducer', () => {
updateShortUrl.mockRejectedValue(error);
try {
await editShortUrl(buildShlinkApiClient)(shortCode, undefined, { longUrl })(dispatch, createGetState());
await editShortUrl(buildShlinkApiClient)({ shortCode, data: { longUrl } })(dispatch, createGetState());
} catch (e) {
expect(e).toBe(error);
}