问题
Sails.js uses the MVC pattern for Node.js and I was wondering if Mocha could be hooked up for testing Models.
回答1:
I know you asked this awhile ago, but I was searching around myself and there's not much out there at the moment. I figured I'd drop what I found into this answer...
I found some discussion on the sails github and a gist with some example code.
There is also a second discussion with more examples.
回答2:
Check out wolfpack. It's a SailsJS model-testing library that allows you to test Sails models without the need for a db or lifting your sails app.
来源:https://stackoverflow.com/questions/17579435/is-it-possible-to-use-the-mocha-framework-against-a-model-in-sails-js