How to do the rest api integration test base on express in meteor


#1

Hello,

refer to this topic, Official Rest API support in Meteor?

I am able to integrate express to meteor, but can not do integration api test.

I have tried meteor test --full-app --driver-package meteortesting:mocha it did not work.
https://github.com/imhazige/benchmark-test-java-php-nodejs/blob/master/nodejs/meteor/test/t1-test.js also I have used normal mocha style by using meteor test mocha, but it throw error ‘mocha is not a command’,
it does working when in a normal express project
ttps://github.com/imhazige/benchmark-test-java-php-nodejs/tree/master/nodejs/express/test (miss first character h as new user only can post 2 links)


#2

can’t believe there are even no one reply after days gone.:slightly_frowning_face::weary:


#4

I resolve it by using normal express testing way https://github.com/imhazige/benchmark-test-java-php-nodejs/blob/master/nodejs/meteor/test/base-test.js.

I have watch the forum for a while, can not get much help, I am really doubt if I should use meteor for production as there are too little resource to get when encounter problems.:slightly_frowning_face:


#5

Meteor uses connect internally (through its webapp package). The number of community members using Meteor with express is probably in the very low single digit percentages. The number of those users doing integration tests is (sadly) likely to be a similar small percentage of that already small percentage.

Meteor abstracts away much of the complexity of needing to deal with middleware directly, so Meteor’s REST solutions tend to be embedded into packages offering various levels of features.

If you want to roll your own REST functionality by dealing with the middleware directly, you can most definitely use express, or connect via webapp. However, you may get a better response here if you use webapp, or one of the Meteor REST packages.

Comparing connect and express.


#6

Good to know, thanks.


#7

Last year when I tried to use Express with Meteor there was almost no help. Most Meteor devs do not use Express of course. I ended up figuring it out, but just as @robfallows said, I’m not really using a test suite, so I can be of no help on this front. :slight_smile: Good luck!