Updated mercure integration so that the hook accepts a list of topics to subscribe

This commit is contained in:
Alejandro Celaya
2021-02-28 10:12:30 +01:00
parent 71ee886e24
commit 9904ac757b
10 changed files with 41 additions and 21 deletions

View File

@@ -20,7 +20,7 @@ describe('helpers', () => {
[ Mock.of<MercureInfo>({ loading: false, error: false, mercureHubUrl: undefined }) ],
[ Mock.of<MercureInfo>({ loading: true, error: true, mercureHubUrl: undefined }) ],
])('does not bind an EventSource when loading, error or no hub URL', (mercureInfo) => {
bindToMercureTopic(mercureInfo, '', identity, identity);
bindToMercureTopic(mercureInfo, [ '' ], identity, identity);
expect(EventSource).not.toHaveBeenCalled();
expect(onMessage).not.toHaveBeenCalled();
@@ -40,7 +40,7 @@ describe('helpers', () => {
error: false,
mercureHubUrl,
token,
}, topic, onMessage, onTokenExpired);
}, [ topic ], onMessage, onTokenExpired);
expect(EventSource).toHaveBeenCalledWith(hubUrl, {
headers: {