mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-04-19 04:56:17 +00:00
Extracted helper fetch function and migrated remoteServers redux action from axios to fetch
This commit is contained in:
@@ -6,10 +6,8 @@ import { ShortUrl, ShortUrlsOrder } from '../../../src/short-urls/data';
|
||||
import { Fetch } from '../../../src/utils/types';
|
||||
|
||||
describe('ShlinkApiClient', () => {
|
||||
const buildFetch = (data: any) => jest.fn().mockResolvedValue({ json: () => Promise.resolve(data), ok: true });
|
||||
const buildRejectedFetch = (error: any) => jest.fn().mockResolvedValueOnce(
|
||||
{ json: () => Promise.resolve(error), ok: false },
|
||||
);
|
||||
const buildFetch = (data: any) => jest.fn().mockResolvedValue(data);
|
||||
const buildRejectedFetch = (error: any) => jest.fn().mockRejectedValueOnce(error);
|
||||
const buildApiClient = (fetch: Fetch) => new ShlinkApiClient(fetch, '', '');
|
||||
const shortCodesWithDomainCombinations: [string, OptionalString][] = [
|
||||
['abc123', null],
|
||||
|
||||
Reference in New Issue
Block a user