是否有可能在一个类的私有方法上使用 Jasmine 单元测试框架的 spyon 方法?
文档给出了这个例子,但是对于私有函数来说这是灵活的吗?
describe("Person", function() {
it("calls the sayHello() function", function() {
var fakePerson = new Person();
spyOn(fakePerson, "sayHello");
fakePerson.helloSomeone("world");
expect(fakePerson.sayHello).toHaveBeenCalled();
});
});