diff --git a/test/api/services/ShlinkApiClient.test.ts b/test/api/services/ShlinkApiClient.test.ts index 6b08a82e..88bab25f 100644 --- a/test/api/services/ShlinkApiClient.test.ts +++ b/test/api/services/ShlinkApiClient.test.ts @@ -115,6 +115,28 @@ describe('ShlinkApiClient', () => { }); }); + describe('getDomainVisits', () => { + it('properly returns domain visits', async () => { + const expectedVisits = ['foo', 'bar']; + const axiosSpy = createAxiosMock({ + data: { + visits: { + data: expectedVisits, + }, + }, + }); + const { getDomainVisits } = new ShlinkApiClient(axiosSpy, '', ''); + + const actualVisits = await getDomainVisits('foo.com', {}); + + expect({ data: expectedVisits }).toEqual(actualVisits); + expect(axiosSpy).toHaveBeenCalledWith(expect.objectContaining({ + url: '/domains/foo.com/visits', + method: 'GET', + })); + }); + }); + describe('getShortUrl', () => { it.each(shortCodesWithDomainCombinations)('properly returns short URL', async (shortCode, domain) => { const expectedShortUrl = { foo: 'bar' };