Я пытаюсь изучить тестирование, и сейчас у меня много проблем.У меня возникли проблемы с тестированием моего углового компонента 1.5
Вот мой самый основной компонент:
(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";
}
}());
Все, что я пытаюсь сделать в моем тесте, чтобы убедиться, что «тест» равно «тест», но я получаю следующее сообщение об ошибке в моей консоли : 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");
});
});
Может кто-нибудь, пожалуйста, помогите мне?