Guest User

Untitled

a guest
Jul 19th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. var mockedSetFunction, mockedFindFunction, setMockObject, findMockObject;
  2. module("Todos.main", {
  3. setup: function() {
  4. mockedSetFunction = Todos.tasksController.set; //ADDED THIS
  5. setMockObject = CoreTest.stub('Todos.tasksController.set', function() { return YES; }); //ADDED THIS
  6. Todos.tasksController.set = setMockObject; //ADDED THIS
  7.  
  8. mockedFindFunction = Todos.store.find;
  9. findMockObject = CoreTest.stub('Todos.store.find', function() { return YES; });
  10. Todos.store.find = findMockObject;
  11. Todos.main();
  12. },
  13.  
  14. teardown: function() {
  15. Todos.getPath('mainPage.mainPane').remove();
  16. Todos.tasksController.set = mockedSetFunction;//ADDED THIS
  17. Todos.store.find = mockedFindFunction;
  18. }
  19. });
  20.  
  21. test("setup finding tasks", function() {
  22. equals(findMockObject.callCount, 1, "Should delegate to the store to find the tasks");
  23. });
  24.  
  25. test("setup tasksController content", function() {
  26. equals(setMockObject.callCount, 1, "Should delegate to the tasksController to setup content"); //ADDED THIS
  27. });
Add Comment
Please, Sign In to add comment