Guest User

Untitled

a guest
Jan 20th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. beforeEach( function() {
  2. server = sinon.fakeServer.create();
  3. server.autoRespond = true;
  4. colhedoraList = new ColhedoraList();
  5. });
  6.  
  7. .
  8. .
  9. .
  10. var spy = sinon.spy(colhedoraList, 'parse');
  11.  
  12. server.respondWith("GET", "getColhedoraInfo",
  13. [200, {"Content-Type": "application/json"},
  14. '[{"id":"1","talhaoAtual":1,"posicionamentos":[{"lat":-23.9317401,"lng":-50.2210379,"elevadorLigado":true,"horario":"2012-09-21T11:27:58Z"},{"lat":-23.931544,"lng":-50.2161884,"elevadorLigado":true,"horario":"2012-09-21T11:28:02Z"}]}]']);
  15.  
  16. colhedoraList.fetch({add: true});
  17. server.respond();
  18. expect(spy).toHaveBeenCalled();
  19. expect(spygmaps).toHaveBeenCalledTwice();
  20. expect(colhedoraList.get(1).get('talhaoAtual')).toEqual(1); <<< ALL EXPECTS FAIL, If I don't call respond().
Add Comment
Please, Sign In to add comment