mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2025-05-02 01:40:34 +03:00
Created section to display orphan visits stats
This commit is contained in:
parent
46d012b6ff
commit
5479210366
23 changed files with 342 additions and 36 deletions
test/api/services
|
@ -4,6 +4,7 @@ import { OptionalString } from '../../../src/utils/utils';
|
|||
import { Mock } from 'ts-mockery';
|
||||
import { ShlinkDomain, ShlinkVisitsOverview } from '../../../src/api/types';
|
||||
import { ShortUrl } from '../../../src/short-urls/data';
|
||||
import { Visit } from '../../../src/visits/types';
|
||||
|
||||
describe('ShlinkApiClient', () => {
|
||||
const createAxios = (data: AxiosRequestConfig) => (async () => Promise.resolve(data)) as unknown as AxiosInstance;
|
||||
|
@ -285,4 +286,18 @@ describe('ShlinkApiClient', () => {
|
|||
expect(result).toEqual(expectedData);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getOrphanVisits', () => {
|
||||
it('returns orphan visits', async () => {
|
||||
const expectedData: Visit[] = [];
|
||||
const resp = { visits: expectedData };
|
||||
const axiosSpy = createAxiosMock({ data: resp });
|
||||
const { getOrphanVisits } = new ShlinkApiClient(axiosSpy, '', '');
|
||||
|
||||
const result = await getOrphanVisits();
|
||||
|
||||
expect(axiosSpy).toHaveBeenCalled();
|
||||
expect(result).toEqual(expectedData);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue