Joh*_*ohn 3 javascript coffeescript jasmine jasmine-jquery
当我运行我的茉莉花规格时,我收到以下错误:
Error: Expected a spy, but got undefined.
Run Code Online (Sandbox Code Playgroud)
我的coffeescript代码:
describe "setupForm", ->
beforeEach ->
spyOn(Subscription.prototype, 'runSimulation')
it "calls subscription.runSimulation when form is submitted with number", ->
Subscription.prototype.runSimulation()
expect(Subscription.prototype.runSimulation()).toHaveBeenCalled()
Run Code Online (Sandbox Code Playgroud)
我已经将我的错误代码简化为上面的调试,但是我无法弄清楚为什么当我明确地将它称为我的测试时它是从未调用过的.我正在其他地方测试该方法,所以我认为错误必须与我如何使用Jasmine Spy有关.谢谢.
Chr*_*erg 14
就拿()离结束Subscription.prototype.runSimulation():
expect(Subscription.prototype.runSimulation).toHaveBeenCalled()
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7874 次 |
| 最近记录: |