title: Unit testing validation with express-validator
body: <p>How can I unit test my validations that are done using express-validator?</p>
  
  <p>I have tried creating a dummy request object, but I get the error: <code>TypeError: Object #&lt;Object&gt; has no method 'checkBody'</code>. I am able to manually test that the validation works in the application.</p>
  
  <p>Here is what I have tried:</p>
  
  <pre><code>describe('couponModel', function () {
      it('returns errors when necessary fields are empty', function(done){
          var testBody = {
              merchant : '',
              startDate : '',
              endDate : ''
          };
          var request = {
              body : testBody
          };
          var errors = Model.validateCouponForm(request);
          errors.should.not.be.empty;
          done();
      });
  });
  </code></pre>
  
  <p>My understanding is that the <code>checkBody</code> method is added to the request object when I have <code>app.use(expressValidator())</code> in my express application, but as I am only testing that the validation is working in this unit test I do not have an instance of the express application available, and the validation method that I am testing is not called directly from it anyway as it is only called through a post route, which I do not want to call for a unit test as it involves a database operation.</p>