Created mercure info reducer and loaded info when server is reachable

This commit is contained in:
Alejandro Celaya
2020-04-17 15:51:18 +02:00
parent d231ed3ede
commit 37e6c27461
9 changed files with 85 additions and 7 deletions

View File

@@ -209,4 +209,20 @@ describe('ShlinkApiClient', () => {
expect(result).toEqual(expectedData);
});
});
describe('mercureInfo', () => {
it('returns mercure info', async () => {
const expectedData = {
token: 'abc.123.def',
mercureHubUrl: 'http://example.com/.well-known/mercure',
};
const axiosSpy = jest.fn(createAxiosMock({ data: expectedData }));
const { mercureInfo } = new ShlinkApiClient(axiosSpy);
const result = await mercureInfo();
expect(axiosSpy).toHaveBeenCalled();
expect(result).toEqual(expectedData);
});
});
});