I am currently diving into the world of testing and encountering several challenges.
Below is a simple component that I am working with:
(function () {
"use strict";
angular.module("testList", [])
.component("testList", {
templateUrl: "test-list.component.html",
controllerAs: "model",
controller: testController
});
function testController() {
var model = this;
model.test = "test";
}
}());
My goal in this test scenario is to verify that "test" indeed equals "test". However, on running the test script, I am faced with the error message: undefined is not a function
"use strict";
describe("Testing Component", function () {
var $componentController;
beforeEach(module('testList'));
beforeEach(inject(function(_$componentController_) {
$componentController = _$componentController_;
}));
it("should see if test equals test", function() {
var ctrl = $componentController('testList', null, { test: "test"});
expect(ctrl.test).toEqual("test");
});
});
If anybody could provide some guidance or assistance, I would greatly appreciate it.