Here is the Angular script I am currently using:
var app = angular.module("myApp", []);
app.controller('TestController', function ($scope) {
$scope.test= "TEST";
});
This is how my test file is set up:
describe('first test', function() {
var $scope;
beforeEach(function (){
module('myApp');
inject(function($rootScope, $controller) {
$scope = $rootScope.$new();
ctrl = $controller('TestController', {
$scope: $scope
});
});
it('The scope should contain the test variable', function() {
expect($scope.test).toEqual("TEST");
});
});
Despite my efforts, this test is failing and returning an error that $scope.test is undefined. Upon further investigation in Chrome's debugger, I noticed that $scope has various properties but none of them include the test property. After reviewing numerous examples online, I am still unable to pinpoint the issue. Any help or suggestions would be greatly appreciated as I have hit a roadblock...
Edit: I attempted adding $controller to inject, however, the problem persists.