function whenEnteringState(state, doThis) {
    stateChangeSpy.and.callFake((event) => {
      if (event.state == state) {
        doThis();
      }
    });
  }
Overwrite our |stateChangeSpy| so that it will do |doThis| when we
enter |state|. |doThis| will be executed synchronously to ensure that
it is done before the walker does its next action.

@param {string} state
@param {function()} doThis