title: How can I mock ui-router's resolve values when testing a state's configuration?
body: <p>I'm writing an angular application using ui-router and I'm looking to write tests for my ui-router configuration.</p>
  
  <p>Specifically, I'm looking to test my <code>onEnter</code> and <code>onExit</code> callbacks bound to a state. These callbacks rely on resolves which are defined on the state. How can I mock out the resolves being used in the <code>onEnter</code> and <code>onExit</code> functions?</p>
  
  <p>For example, say I have a state defined as follows:</p>
  
  <pre><code>// bobConfig.js
  .state('bob', {
      url: '/bob',
      templateUrl: "bob.html",
      controller: "bobController",
      resolve: {
          currentUser: function() {
              return "Bob Bobbertson";
          }
      },
      onEnter: function(currentUser) {
          if(currentUser == "Bob Bobbertson") {
              console.log("hello bob!");
          } else {
              console.log("hey, you aren't bob!");
          }
      }
  });
  </code></pre>
  
  <p>In this example, I'd like to test the <code>"hey, you aren't bob!"</code> message functionality. </p>
  
  <p>For starters, I'd write something like this:</p>
  
  <pre><code>// productsConfig.spec.js
  describe("Products state config", function(){
      it("should tell everyone but bob that they aren't bob", function() {
          // set up currentUser to return "Sally Sallington"
          expectYouArentBobMessageToBePrinted();
      });
  });
  </code></pre>
  
  <p>In the above jasmine test example, how would I make it so that the <code>currentUser</code> being used in my <code>onEnter</code> has a value of <code>"Sally Sallington"</code>?</p>