Answer the question
In order to leave comments, you need to log in
How to cover microservice on moleculer with tests?
We decided to back up a new project on microservices using the new moleculer library for us (mongoDB database via moleculer-db is also used), but then the question arose of covering these microservices with tests (using mocha + chai). Unfortunately, I did not find articles on this issue on the Internet and I want to know the opinion of the community on how to organize this. Links to articles are welcome.
Answer the question
In order to leave comments, you need to log in
And what is the difficulty? Pack the test suite in describe. In each test, using request for example , you call your microservice endpoint, and check if the response was able to get what you expected?
describe('spec', () => {
const request = require('request');
it('should return one', (done) => {
request('http://localhost/api/one', (err, resp) => {
assert.equal('One', resp.body);
done();
});
});
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question