mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 01:20:24 +03:00
Added new test
This commit is contained in:
parent
3b6453e4ea
commit
9aaa01e455
1 changed files with 26 additions and 0 deletions
26
test/api/ShlinkApiClient.test.js
Normal file
26
test/api/ShlinkApiClient.test.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
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);
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue