I am testing my controller which has a parent scope variable reference. But it is giving variable undefined error.

**subscription (controller)**

```
var vm = this;
var userId=$scope.$parent.vm.userId;
var simId=$scope.$parent.vm.simId;

```

**subscriptionSpec (spec file)**

```
describe('subscription controller',function (){
    var SubscriptionListCtrl,scope;
    beforeEach(module('app'));

    beforeEach(inject(function($controller,$compile,SubscriptionService,dataTableConfigService,commonUtilityService){
    scope={};
    scope.vm={};

    SubscriptionListCtrl=$controller("SubscriptionListCtrl",{$scope:scope,$compile:$compile,SubscriptionService:SubscriptionService,dataTableConfigService:dataTableConfigService,commonUtilityService:commonUtilityService});

    }));
});

```

**Karma Jasmine Error**

```
TypeError: Cannot read property 'vm' of undefined

```

This comes because of the controller statement 

> 
> var userId=$scope.$parent.vm.userId;
> 
> 
> 

Also if I replace the $scope.$parent.vm.userId with actual value then it will not give any error.

How do I write the test case for this line?