I am trying to test the response from a service http call that is performed within a controller:
Controller:
define(['module'], function (module) {
    'use strict';
    var MyController = function ($scope, MyService) {
        var vm = this;
        $scope.testScope = 'karma is working!';
        MyService.getData().then(function (data) {
            $scope.result = data.hour
            vm.banner = {
                'greeting': data.greeting
            }
        });
    };    
    module.exports = ['$scope', 'MyService', MyController ];
});
Unit test:
define(['require', 'angular-mocks'], function (require) {
'use strict';
var angular = require('angular');
describe("<- MyController Spec ->", function () {    
    var controller, scope, myService, serviceResponse;
    serviceResponse= {
        greeting: 'hello',
        hour: '12'
    };
    beforeEach(angular.mock.module('myApp'));
    beforeEach(inject(function (_$controller_, _$rootScope_, _MyService_, $q) {
        scope = _$rootScope_.$new();
        var deferred = $q.defer();
        deferred.resolve(serviceResponse);
        myService = _MyService_;
        spyOn(myService, 'getData').and.returnValue(deferred.promise);
        controller = _$controller_('MyController', {$scope: scope});  
        scope.$apply();
    }));
    it('should verify that the controller exists ', function() {
        expect(controller).toBeDefined();
    });    
    it('should have testScope scope equaling *karma is working*', function() {
        expect(scope.testScope ).toEqual('karma is working!');
    });
});
});
How can i test the http request is performed and returns serviceResponse which binds to $scope.result and vm.banner greeting
Ive tried:
define(['require', 'angular-mocks'], function (require) {
'use strict';
var angular = require('angular');
describe("<- MyController Spec ->", function () {    
    var controller, scope, myService, serviceResponse, $httpBackend;
    serviceResponse= {
        greeting: 'hello',
        hour: '12'
    };
    beforeEach(angular.mock.module('myApp'));
    beforeEach(inject(function (_$controller_, _$rootScope_, _MyService_, _$httpBackend_) {
        scope = _$rootScope_.$new();
        $httpBackend = _$httpBackend_
        $httpBackend.expectGET("/my/endpoint/here").respond(serviceResponse);
        myService = _MyService_;
        spyOn(myService, 'getData').and.callThrough();
        controller = _$controller_('MyController', {$scope: scope});  
        scope.$apply();
    }));
    it('should call my service and populate scope.result ', function() {
        myService.getData();
        expect(scope.result ).toEqual(serviceResponse.hour);
    });
    it('should verify that the controller exists ', function() {
        expect(controller).toBeDefined();
    });    
    it('should have testScope scope equaling *karma is working*', function() {
        expect(scope.testScope ).toEqual('karma is working!');
    });
});
});
With the error:
[should call my service and populate scope.result -----     Expected undefined to be defined.
 
     
     
    