Testing packages
In the previous chapter, we built a package out of the ReactiveTimer
object. A good package should always contain unit tests so that people can run them and be sure that changes to that package don't break its functionality.
Meteor provides a simple unit test tool for packages, called TinyTest
, which we will use to test our package:
- To add tests, we need to copy the
meteor-book:reactive-timer
package, which we built in the previous chapter, to themy-meteor-blog/packages
folder of our app. This way, we can make changes to the package, as Meteor will prefer the package in thepackages
folder over one in its package servers. If you removed the package, simply add it back using the following command:$ meteor add meteor-book:reactive-timer
Note
Additionally, we need to make sure we delete the
my-meteor-blog/client/ReactiveTimer.js
file, which we should have if we used the code example from Chapter 10, Deploying Our App, as a basis. - Then we open the
package.js
file from our...