{"action":"closed","issue":{"url":"https://api.github.com/repos/arnaudbenard/redux-mock-store/issues/81","repository_url":"https://api.github.com/repos/arnaudbenard/redux-mock-store","labels_url":"https://api.github.com/repos/arnaudbenard/redux-mock-store/issues/81/labels{/name}","comments_url":"https://api.github.com/repos/arnaudbenard/redux-mock-store/issues/81/comments","events_url":"https://api.github.com/repos/arnaudbenard/redux-mock-store/issues/81/events","html_url":"https://github.com/arnaudbenard/redux-mock-store/issues/81","id":197493463,"number":81,"title":"async function does not working proparly","user":{"login":"YossiYadgar","id":23238590,"avatar_url":"https://avatars3.githubusercontent.com/u/23238590?v=3","gravatar_id":"","url":"https://api.github.com/users/YossiYadgar","html_url":"https://github.com/YossiYadgar","followers_url":"https://api.github.com/users/YossiYadgar/followers","following_url":"https://api.github.com/users/YossiYadgar/following{/other_user}","gists_url":"https://api.github.com/users/YossiYadgar/gists{/gist_id}","starred_url":"https://api.github.com/users/YossiYadgar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YossiYadgar/subscriptions","organizations_url":"https://api.github.com/users/YossiYadgar/orgs","repos_url":"https://api.github.com/users/YossiYadgar/repos","events_url":"https://api.github.com/users/YossiYadgar/events{/privacy}","received_events_url":"https://api.github.com/users/YossiYadgar/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-12-25T09:10:47Z","updated_at":"2017-03-21T09:40:12Z","closed_at":"2017-03-21T09:40:12Z","body":"I tryed to test a little unit that handle dispatches after promise returned in a sync way, but for some reason, I am always get an empty actions array from store.getActions(). Can someone help me?\r\nbtw, the action is:\r\n\r\n\r\n```javascript\r\nexport function firstRefresh(instrumentId) \r\n{\r\n  return dispatch => \r\n  {\r\n    Router.refresh(instrumentId, 0)\r\n      .then((data) =>\r\n      {\r\n        try \r\n        {\r\n          dispatch(setAssetsByMarkets(data.assetsByMarketsObj));\r\n          dispatch(setAssetsAndOptionsFirstTime(data));\r\n          dispatch(setMarkets(data.markets)); \r\n        } \r\n        catch (error) \r\n        {\r\n          console.error('an error catched: ', error);\r\n        }\r\n      }).catch( () => \r\n      {\r\n        dispatch(setAssetsAndOptions({assets : [], options : []}));\r\n      });\r\n  };\r\n}\r\n```\r\n\r\n\r\nand the test is:\r\n\r\n\r\n```javascript\r\ndescribe('async actions', () => {\r\n  it('firstRefresh success', () => {\r\n    const instrumentId = ...,\r\n      serverUrl =...,\r\n      serverPostPath = ...,\r\n      timeStamp = new Date().getTime(),\r\n      replayStatusCode = 200,\r\n      mockReplayBody = {...\r\n      },\r\n      requestHeaders = {\r\n        reqheaders: {...}\r\n      },\r\n      requestBody = {...\r\n      },\r\n      store = mockStore(storeInitialState)\r\n\r\n    nock(serverUrl, requestHeaders) \r\n      .post(serverPostPath)\r\n      .reply(replayStatusCode, {body: mockReplayBody}) \r\n\r\n    const expectedActions = [\r\n      {\r\n        type: 'SET_ASSETS_BY_MARKETS',\r\n        value: mockReplayBody.assetsByMarketsObj\r\n      }, {\r\n        type: 'SET_ASSETS_AND_OPTIONS_FIRST_TIME',\r\n        data: mockReplayBody\r\n      }, {\r\n        type: 'UPDATE_MARKETS',\r\n        value: mockReplayBody.markets\r\n      }\r\n    ]\r\n\r\n    store.dispatch(actions.firstRefresh(instrumentId))\r\n    expect(store.getActions()).toEqual(expectedActions)\r\n  })\r\n})\r\n```\r\n"}}
{"actor":{"display_login":"arnaudbenard"}}