Here is a simple function I have:
wpApp = angular.module('wpApp', ['ngRoute']);
wpApp.controller("ctrlr", function($scope) {
$scope.message = 'This is the page';
});
I am attempting to test it using Jasmine with this spec:
describe("Testing suite", function() {
var scope;
beforeEach(inject(function($rootScope, $controller) {
scope = $rootScope.$new();
$controller("controller", {
$scope: scope
});
}));
it("should display the default message", function() {
return expect(scope.message).toBe('This is the page');
});
});
Unfortunately, it is not functioning as expected, as the actual value is returning as Undefined.
Since I am new to AngularJS and the concept of injection, I have been researching on StackOverflow, the documentation, and various tutorials, but I am still unable to pinpoint the exact issue.
Hopefully, the solution is a simple one. Can someone offer guidance on what adjustments I need to make to my spec?