KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to implement a test (1) for this module (2). My purpose is to check if the collection is fetched when a particular event is triggered. As you can see from my comment in (2) I get the message Error: Expected a spy, but got Function. The module works but the test fails. any ideas? (1) // jasmine test module describe('When onGivePoints is fired', function () { beforeEach(function () { spyOn(this.view.collection, 'restartPolling').andCallThrough(); app.vent.trigger('onGivePoints'); }); it('the board collection should be fetched', function () { expect(this.view.collection.restartPolling).toHaveBeenCalled(); // Error: Expected a spy, but got Function. }); }); (2) // model view module return Marionette.CompositeView.extend({ initialize: function () { this.collection = new UserBoardCollection(); this.collection.startPolling(); app.vent.on('onGivePoints', this.collection.restartPolling); }, // other code });
Tags (comma-separated)
Save Edits
Cancel