mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 09:30:31 +03:00
Added test for ShlinkApiClient.getDomainVisits
This commit is contained in:
parent
05254326cb
commit
77e59c886d
1 changed files with 22 additions and 0 deletions
|
@ -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', () => {
|
describe('getShortUrl', () => {
|
||||||
it.each(shortCodesWithDomainCombinations)('properly returns short URL', async (shortCode, domain) => {
|
it.each(shortCodesWithDomainCombinations)('properly returns short URL', async (shortCode, domain) => {
|
||||||
const expectedShortUrl = { foo: 'bar' };
|
const expectedShortUrl = { foo: 'bar' };
|
||||||
|
|
Loading…
Reference in a new issue