MCQs > Website Designing & Development > BackBone.js > BackboneJS test with jasmine if parameters are passed to fetch?

BackBone.js MCQs

BackboneJS test with jasmine if parameters are passed to fetch?

Answer

Correct Answer: describe("People collection" function() { var people = Backbone.Collection.extend({ }); function searchPeople(people, data ) { people.fetch(data); } it("must verify the fetch parameters!", function(){ var param = {data : {gender : 'male'}}; spyOn(people, 'fetch').andReturn(); // Warning: this makes the call synchronous, Fetch actually won't go through! searchPeople(people, param); expect(people.fetch).toHaveBeenCalled(); expect(people.fetch).toHaveBeenCalledWith(param); }); });

Explanation:

Note: This Question is unanswered, help us to find answer for this one

BackBone.js Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

BackBone.js Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it