Added changes to load orphan visits and fixed tests

This commit is contained in:
Alejandro Celaya
2022-02-05 13:37:49 +01:00
parent 60929342fb
commit 8fbe6bb17d
10 changed files with 63 additions and 34 deletions

View File

@@ -313,6 +313,20 @@ describe('ShlinkApiClient', () => {
});
});
describe('getNonOrphanVisits', () => {
it('returns non-orphan visits', async () => {
const expectedData: Visit[] = [];
const resp = { visits: expectedData };
const axiosSpy = createAxiosMock({ data: resp });
const { getNonOrphanVisits } = new ShlinkApiClient(axiosSpy, '', '');
const result = await getNonOrphanVisits();
expect(axiosSpy).toHaveBeenCalled();
expect(result).toEqual(expectedData);
});
});
describe('editDomainRedirects', () => {
it('returns the redirects', async () => {
const resp = { baseUrlRedirect: null, regular404Redirect: 'foo', invalidShortUrlRedirect: 'bar' };