2017-08-28 81 views

回答

0
it("tracks the number of times it was called", function() { 
    spyOn(foo, 'setBar'); 

    expect(foo.setBar.calls.count()).toEqual(0); 

    foo.setBar(); 
    foo.setBar(); 

    expect(foo.setBar.calls.count()).toEqual(2); 
    }); 
+0

僅有代碼的答案通常不會自行工作 - 請添加一個解釋,說明如何幫助解決問題 – Mikkel

相關問題