xolvio/velocity-example — pull request #3 by Sanjo (2014-07-10 23:06:12+00:00)
Title: Refactored leaderboard code and added jasmine tests.

I refactored the leaderboard sample app to make it easier to test and reuse the code.
I introduced a PlayerService that does all the Player related stuff. After the refactoring the template helpers's only concern is to connect the UI with the "business logic".
Testing the service is really easy because it is disconnected from the UI.
Testing the template helpers is also easier because they don't do much. They basically just delegate the work to the service.

Because I can't write Coffeescript, I got rid of it. I hope you can live with this.

I covered the whole app with my Jasmine package too. Based on the existing tests of jasmine-unit and mocha-web.

Something special: The Jasmine unit tests run in the same app instance in the browser where the integration tests run. The Meteor API is stubbed while the unit tests run. This is achieved with the beforeEach and afterEach block. And a install/uninstall pattern is used for the stubs (that I found in the Jasmine clock mock).