How to mock "document" object for tests?


#1

I’m using mocha and chai for testing, and have a module that uses the document object. The test is running on the server which of course triggers “document is not defined.” What’s the best way to mock the document object or to otherwise perform tests that use this module?

I haven’t been able to figure out how to use packages like jsdom, jsdomify, and etc. I’ve also tried following the Meteor Guide’s testing sections for integration testing and full-app testing but I have become stuck.

Any suggestions would be much appreciated! Thanks!