title: Unit testing the config phase in AngularJS
body: <p>I'm trying to learn how to write unit tests for AngularJS. I started at the beginning, with </p>
  
  <p><code>angular.module( ... ).config( ... )</code></p>
  
  <p>I wanna test what's inside config. Here's how the relevant portions look like:</p>
  
  <pre class="lang-js prettyprint-override"><code>angular.module('ogApp', ['ngCookies','ui.router','ogControllers','ogServices','ogDirectives','ogMetricsData'])
  
  .config([
    '$stateProvider', '$locationProvider',
    function ($stateProvider, $locationProvider) {
      $stateProvider.
        state('login', {
          templateUrl: 'connect.html'
        }).state('addViews', {
          templateUrl: 'add-views.html'
        }).state('dashboard', {
          templateUrl: 'dashboard.html'
        });
      $locationProvider.
        html5Mode(true).
        hashPrefix('!');
    }
  ]);
  </code></pre>
  
  <p>I'm thinking the easiest way to test this code is to inject mocks for <code>$stateProvider</code> and <code>$locationProvider</code>. Then execute the config phase. After that, assert how <code>$stateProvider</code> and <code>$locationProvider</code> should look like.</p>
  
  <p>If my thinking is right, my problem then is, I have no idea how to inject those mocks into the module and execute its config phase from a test.</p>
  
  <p>Could you show me how to test this code?</p>