Added support to dispatch all UI actions based on mercure bindings on a specific schedule instead of real time

This commit is contained in:
Alejandro Celaya
2020-09-12 08:52:03 +02:00
parent 9b45513684
commit ad437f655e
10 changed files with 31 additions and 18 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: {

View File

@@ -36,11 +36,11 @@ describe('mercureInfoReducer', () => {
});
it('returns mercure info on GET_MERCURE_INFO', () => {
expect(reducer(undefined, { type: GET_MERCURE_INFO, ...mercureInfo })).toEqual({
expect(reducer(undefined, { type: GET_MERCURE_INFO, ...mercureInfo })).toEqual(expect.objectContaining({
...mercureInfo,
loading: false,
error: false,
});
}));
});
});

View File

@@ -19,7 +19,7 @@ describe('<TagsList />', () => {
wrapper = shallow(
<TagsListComp
{...Mock.all<TagsListProps>()}
{...Mock.all<MercureBoundProps>()}
{...Mock.of<MercureBoundProps>({ mercureInfo: {} })}
forceListTags={identity}
filterTags={filterTags}
tagsList={Mock.of<TagsList>(tagsList)}

View File

@@ -26,7 +26,7 @@ describe('<ShortUrlVisits />', () => {
wrapper = shallow(
<ShortUrlVisits
{...Mock.all<ShortUrlVisitsProps>()}
{...Mock.all<MercureBoundProps>()}
{...Mock.of<MercureBoundProps>({ mercureInfo: {} })}
getShortUrlDetail={identity}
getShortUrlVisits={getShortUrlVisitsMock}
match={match}

View File

@@ -26,7 +26,7 @@ describe('<TagVisits />', () => {
wrapper = shallow(
<TagVisits
{...Mock.all<TagVisitsProps>()}
{...Mock.all<MercureBoundProps>()}
{...Mock.of<MercureBoundProps>({ mercureInfo: {} })}
getTagVisits={getTagVisitsMock}
match={match}
history={history}