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没有期望 - 在运行测试单元之前是否需要在测试文件中设置变量的值?