     describe 'Unit Testing Router', ->
       # The mock Router service module.
       Router = null
-    
+
       # The mock Angular $http service provider.
       $httpBackend = null
-      
+
       $rootScope = null
-      
+
       # The mock objects.
       mock =
         subject:

          expect(mdl.delta_k_trans, "Delta Ktrans is not #{ mock_delta_k_trans }")
            .to.be.closeTo(mock_delta_k_trans, 0.0000001)

        it 'should fetch the detail with a subject detail property', ->
          subject = _.clone(mock.subject)
          Router.getSubjectDetail(subject, {}).then ->
            validate(subject)
          # Dispatch the backend request.
          $httpBackend.flush()
  
        it 'should fetch the detail with a detail query parameter', ->
          subject = _.omit(mock.subject, 'detail')
          Router.getSubjectDetail(subject, detail: mock.subject.detail).then ->
            validate(subject)
          # Dispatch the backend request.
          $httpBackend.flush()

        it 'should fetch the detail without a detail property or parameter', ->
          subject = _.omit(mock.subject, 'detail')
          Router.getSubjectDetail(subject, {}).then ->
            validate(subject)
          # Dispatch the backend request.
          $httpBackend.flush()

      # TODO - add Session tests.

          ]
        session_detail:
          scan:
            name: 'scan'
            intensity:
              intensities: [2.4]
          registrations: [
            name: 'reg_test'
            intensity:
              intensities: [3.1]
          ]

      beforeEach ->
        # Fake the router service module.
        angular.mock.module('qiprofile.router')

        inject ['Router', '$httpBackend', '$rootScope',
          (_Router_, _$httpBackend_, _$rootScope_) ->
            Router = _Router_
            $httpBackend = _$httpBackend_
            $rootScope = _$rootScope_

            # The mock subjects http call.
            url = encodeURI('/api/subjects?where=' +
                            '{"project":"QIN_Test","collection":"Breast","number":1}')
            $httpBackend.whenGET(url).respond(JSON.stringify(_items: [mock.subject]))

            # The mock subject-detail http call.
            url = encodeURI('/api/subject-detail/a')
            $httpBackend.whenGET(url).respond(JSON.stringify(mock.subject_detail))

            # The mock session-detail http call.
            url = encodeURI('/api/session-detail/b')
            $httpBackend.whenGET(url).respond(JSON.stringify(mock.session_detail))
        ]

      afterEach ->
        $httpBackend.verifyNoOutstandingExpectation()
        $httpBackend.verifyNoOutstandingRequest()

      describe 'Subject Detail', ->
        # Validates the resolved subject.
