mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-14 03:23:49 +00:00
Fixed tests
This commit is contained in:
@@ -54,6 +54,7 @@ describe('shortUrlCreationReducer', () => {
|
||||
createShortUrl: sinon.fake.returns(result),
|
||||
});
|
||||
const dispatch = sinon.spy();
|
||||
const getState = () => ({});
|
||||
|
||||
afterEach(() => dispatch.resetHistory());
|
||||
|
||||
@@ -61,9 +62,9 @@ describe('shortUrlCreationReducer', () => {
|
||||
const expectedDispatchCalls = 2;
|
||||
const result = 'foo';
|
||||
const apiClientMock = createApiClientMock(Promise.resolve(result));
|
||||
const dispatchable = _createShortUrl(apiClientMock, {});
|
||||
const dispatchable = _createShortUrl(() => apiClientMock, {});
|
||||
|
||||
await dispatchable(dispatch);
|
||||
await dispatchable(dispatch, getState);
|
||||
|
||||
expect(apiClientMock.createShortUrl.callCount).toEqual(1);
|
||||
|
||||
@@ -76,10 +77,10 @@ describe('shortUrlCreationReducer', () => {
|
||||
const expectedDispatchCalls = 2;
|
||||
const error = 'Error';
|
||||
const apiClientMock = createApiClientMock(Promise.reject(error));
|
||||
const dispatchable = _createShortUrl(apiClientMock, {});
|
||||
const dispatchable = _createShortUrl(() => apiClientMock, {});
|
||||
|
||||
try {
|
||||
await dispatchable(dispatch);
|
||||
await dispatchable(dispatch, getState);
|
||||
} catch (e) {
|
||||
expect(e).toEqual(error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user