You can use Jasmine or Mocha as test frameworks for Node.js. In test suites you can use another library: superagent .
The superspy allows you to make HTTP requests to the specified URL.
On the other hand, you have elasticsearch that receives HTTP requests.
You may have a dataset library in the form of http requests to publish to elasticsearch. Each dataset will be suitable for submitting elasticsearch to check if the test passes or fails the test.
Here is an example of how a superagent can be used to request a request to an elasticsearch server:
var request = require('superagent'); var should = require('should.js'); describe('Your test suite', function () { it('Should test elasticsearch search', function (done) { request.get('http://localhost:9002/index/type/_search') .end(function (err, res) { should.not.exist(err); should.exist(res); }); }); });
source share