如何在测试中重新配置一个茉莉花间谍

How can I reconfigure a jasmine spy in a test?

本文关键字:一个 间谍 茉莉花 配置 测试 新配置      更新时间:2023-09-26

如何在测试中重新配置一个jasmine spy ?

var spy = spyOn(foo, 'bar').and.returnValue(0);
//...
spy.and.returnValue(1); // This does not appear to work...

附加到实际的间谍方法:

foo.bar.and.returnValue(1);