0
我是新來編寫測試單位和努力執行我的測試時,我收到以下錯誤:測試中jasmine-返回類型錯誤的錯誤:未定義不是對象
TypeError: undefined is not an object (evaluating '$scope.createRoleForm.canCreateAccount=false')
我想要的功能測試:
function enableAccountRoles() {
$scope.createRoleForm.canCreateAccount = false;
$scope.createRoleForm.canListAccounts = false;
$scope.createRoleForm.canSearchAllChat = false;
$scope.createRoleForm.canManageSite = false;
}
和我的測試代碼
it('should call enableAccountRoles', function() {
this.scope.enableAccountRoles();
})
我知道,這是不完整的,因爲我甲肝e沒有期望 - 在運行測試單元之前是否需要在測試文件中設置變量的值?