How to unit test this Redux thunk? : <p>So I have this Redux action creator that is using <code>redux thunk</code> middleware:</p>

<p><strong>accountDetailsActions.js:</strong></p>

<pre><code>export function updateProduct(product) {
  return (dispatch, getState) =&gt; {
    const { accountDetails } = getState();

    dispatch({
      type: types.UPDATE_PRODUCT,
      stateOfResidence: accountDetails.stateOfResidence,
      product,
    });
  };
}
</code></pre>

<p>How do I test it?  I'm using the <code>chai</code> package for testing.  I have found some resources online, but am unsure of how to proceed.  Here is my test so far:</p>

<p><strong>accountDetailsReducer.test.js:</strong></p>

<pre><code>describe('types.UPDATE_PRODUCT', () =&gt; {
    it('should update product when passed a product object', () =&gt; {
        //arrange
        const initialState = {
            product: {}
        };
        const product = {
            id: 1,
            accountTypeId: 1,
            officeRangeId: 1,
            additionalInfo: "",
            enabled: true
        };
        const action = actions.updateProduct(product);
        const store = mockStore({courses: []}, action);
        store.dispatch(action);
        //this is as far as I've gotten - how can I populate my newState variable in order to test the `product` field after running the thunk?
        //act
        const newState = accountDetailsReducer(initialState, action);
        //assert
        expect(newState.product).to.be.an('object');
        expect(newState.product).to.equal(product);
    });
});
</code></pre>

<p>My thunk doesn't do any asynchronous actions.  Any advice?</p>
