0

I recently created a Meteor package and want to write some tests. What my test package basically do is that users can insert into the template {{> abc}} and they'll get an HTML element printed on the page.

With TinyTest, all you can do is test the package's API using something like test.equal(actual, expected, message, not). However, I need it to test whether the element was successfully printed on the page. Furthermore, I will pass the template some parameters and test them too.

It seems like I'd have to create a dummy app, run bash to initiate the app, and test whether the elements can be found on page. So should I only use TinyTest to test the API, and write my own tests (somehow!) for templating? If not, how should I go about it?

I read something about Blaze.toHTML, but I cannot find anything in the documentation on it? Nor it's source page.

MRocklin
  • 55,641
  • 23
  • 163
  • 235
dayuloli
  • 16,205
  • 16
  • 71
  • 126
  • FYI, [here's the doc for `Blaze.toHTML`](http://docs.meteor.com/#/full/blaze_tohtml). What you looked at is the documentation for the standalone Blaze project. – Peppe L-G Jan 11 '15 at 09:57

1 Answers1

1

I think TinyTest is great for starting with Unit testing, but what you need sounds more like an Integration test.

I would recommend you look into the following links for more info on testing with Meteor, especially with Velocity - Meteor's official testing framework:

You can create a demo application, and run integration tests using Mocha or Jasmine.

Chip Castle
  • 2,132
  • 3
  • 20
  • 34
  • Thanks for your correction, all these testing terms are making me dizzy, I'm checking Velocity out right now! @_@ – dayuloli Jan 11 '15 at 09:20
  • Thanks for the links, so now, I'm using TinyTest to unit test my package, and created an example directory, inside of which I created a test application, and inside that application I am using `mike:mocha` for integration testing. – dayuloli Jan 12 '15 at 04:22