Testing the package
Packages in MeteorJS facilitate writing tests by default. We can use the jasmine
package to test our package. Add it to the application using the meteor add sanjo:jasmine
command. Also, we need a test runner. We will use velocity's html-reporter
, that we have used in the previous chapter. Add the velocity
package using the meteor add velocity:html-reporter
command.
Add the tests
directory to our package directory and remove bucket-tests.js
. We will write the client and server tests separately, as we did for the application in the previous chapter. Create the server
and client
directories inside the tests
directory and add server.js
and client.js
inside the server
and client
directories, respectively.
Let us start adding some tests. Firstly, we will test our server-side code. Inside server.js
, add the following code, which does some basic tests:
describe("Server tests", function() { it("BucketCollection should be defined", function() { expect...