mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 09:30:31 +03:00
27 lines
698 B
JavaScript
27 lines
698 B
JavaScript
|
import { ShlinkApiClient } from '../../src/api/ShlinkApiClient'
|
||
|
|
||
|
describe('ShlinkApiClient', () => {
|
||
|
const createApiClient = extraData => {
|
||
|
const axiosMock = () =>
|
||
|
Promise.resolve({
|
||
|
data: { token: 'foo', ...extraData },
|
||
|
headers: { authorization: 'Bearer abc123' }
|
||
|
});
|
||
|
|
||
|
return new ShlinkApiClient(axiosMock);
|
||
|
};
|
||
|
|
||
|
describe('listShortUrls', () => {
|
||
|
it('properly returns short URLs list', async () => {
|
||
|
const expectedList = ['foo', 'bar'];
|
||
|
|
||
|
const apiClient = createApiClient({
|
||
|
shortUrls: expectedList
|
||
|
});
|
||
|
|
||
|
const actualList = await apiClient.listShortUrls();
|
||
|
expect(expectedList).toEqual(actualList);
|
||
|
});
|
||
|
});
|
||
|
});
|