我是新手,jasmine
这是我src
在其中创建Auth
类的文件
function Auth() {
}
Auth.prototype.isEmpty = function(str) {
return (!str || 0 === str.length);
}
Auth.prototype.Login = function (username , password) {
if (this.isEmpty(username) || this.isEmpty(password)) {
return "Username or Password cann't be blank ";
}
else {
return "Logged In !";
}
}
现在我想测试 jasmine 的toHaveBeenCalled()
matcher 。这是我写的
it("should be able to Login", function () {
spyOn(authobj);
expect(authobj.Login('abc', 'abc')).toHaveBeenCalled();
});
但它说undefined() method does not exist