'use strict';

require('angular');
require('angular-mocks');

describe('Controller: IRSReportCtrl', function () {

    var scope,
        location,
        Session,
        mockEngine = {
            getHmdaJson: function() { return {hmdaFile: { loanApplicationRegisters: []}}; },
            getTotalsByMSA: function() { return []; }
        };

    beforeEach(angular.mock.module('hmdaPilotApp'));

    beforeEach(inject(function ($rootScope, $location, $controller, _Session_) {
        scope = $rootScope.$new();
        location = $location;
        Session = _Session_;

        $controller('IRSReportCtrl', {
            $scope: scope,
            $location: location,
            HMDAEngine: mockEngine,
            Session: _Session_
        });
    }));

    describe('initial scope', function() {
        it('should include the report data', function() {
            expect(scope.reportData).toBeDefined();
        });
    });

    describe('backToSummary()', function() {
        it('should direct the user to the /summaryMSA-IRS page', function () {
            scope.backToSummary();
            scope.$digest();
            expect(location.path()).toBe('/summaryMSA-IRS');
        });
    });

    describe('saveIRSVerification()', function() {
        describe('when IRS report has been verified', function() {
            beforeEach(function() {
                scope.saveIRSVerification({verified: true});
                scope.$digest();
            });

            it('should save the Edit ID to the session', function() {
                expect(Session.hasVerifiedIRSReport()).toBeTruthy();
            });
        });

        describe('when IRS report is not verified', function() {
            beforeEach(function() {
                scope.saveIRSVerification({verified: false});
                scope.$digest();
            });

            it('should save the Edit ID to the session', function() {
                expect(Session.hasVerifiedIRSReport()).toBeFalsy();
            });
        });
    });
});

@@ -757,24 +757,89 @@
    %7D));%0A%0A   
+ // TODO: Add support for returning resolving the promise.%0A    //
  describe('i
@@ -861,32 +861,35 @@
 function() %7B%0A   
+ //
      it('should 
@@ -922,32 +922,35 @@
 function() %7B%0A   
+ //
          expect(
@@ -981,24 +981,27 @@
 fined();%0A   
+ //
      %7D);%0A   
@@ -996,33 +996,45 @@
      %7D);%0A   
+ //
  %7D);%0A
+    //
 %0A   
+ //
  describe('b
@@ -1062,24 +1062,27 @@
 tion() %7B%0A   
+ //
      it('sho
@@ -1140,32 +1140,35 @@
 unction () %7B%0A   
+ //
          scope.b
@@ -1183,32 +1183,34 @@
 mary();%0A    
+//
         
 scope.$diges
@@ -1189,32 +1189,33 @@
 ;%0A    //        
+ 
 scope.$digest();
@@ -1210,32 +1210,35 @@
 e.$digest();%0A   
+ //
          expect(
@@ -1278,24 +1278,27 @@
 A-IRS');%0A   
+ //
      %7D);%0A   
@@ -1297,25 +1297,37 @@
  %7D);%0A   
+ //
  %7D);%0A
+    //
 %0A   
+ //
  describ
@@ -1365,24 +1365,27 @@
 tion() %7B%0A   
+ //
      describ
@@ -1436,32 +1436,34 @@
 ion() %7B%0A    
+//
         
 beforeEach(f
@@ -1442,32 +1442,33 @@
 %7B%0A    //        
+ 
 beforeEach(funct
@@ -1470,32 +1470,35 @@
 function() %7B%0A   
+ //
              sco
@@ -1535,32 +1535,34 @@
 ed: true%7D);%0A    
+//
             scop
@@ -1549,32 +1549,33 @@
   //            
+ 
 scope.$digest();
@@ -1570,32 +1570,35 @@
 e.$digest();%0A   
+ //
          %7D);%0A%0A  
@@ -1590,37 +1590,45 @@
         %7D);%0A
+    //
 %0A    
+//
         
 it('should s
@@ -1607,32 +1607,33 @@
 /%0A    //        
+ 
 it('should save 
@@ -1669,32 +1669,35 @@
 function() %7B%0A   
+ //
              exp
@@ -1741,32 +1741,35 @@
 oBeTruthy();%0A   
+ //
          %7D);%0A   
@@ -1760,32 +1760,35 @@
          %7D);%0A   
+ //
      %7D);%0A%0A      
@@ -1776,28 +1776,37 @@
  //     %7D);%0A
+    //
 %0A   
+ //
      describ
@@ -1850,32 +1850,35 @@
 function() %7B%0A   
+ //
          beforeE
@@ -1889,32 +1889,35 @@
 function() %7B%0A   
+ //
              sco
@@ -1958,24 +1958,27 @@
 false%7D);%0A   
+ //
             
@@ -1994,24 +1994,27 @@
 igest();%0A   
+ //
          %7D);
@@ -2014,20 +2014,29 @@
     %7D);%0A
+    //
 %0A   
+ //
         
@@ -2093,24 +2093,27 @@
 tion() %7B%0A   
+ //
             
@@ -2164,24 +2164,27 @@
 Falsy();%0A   
+ //
          %7D);
@@ -2188,27 +2188,33 @@
 %7D);%0A    
+//
     
+ 
 %7D);%0A   
+ //
  %7D);%0A%7D);

Comment out the irsReport controller tests since for the demo