title: How to test function returning next method with Hippie?
body: <p>I've got a function which returns next(); as a function to allow next route to be called and it's used for checking the token as an interceptor and allows function to go through.</p>
  
  <p>The problem I have now is that I want to test this particular function and I don't have next route it's just that one so when I use some API testing tool like Hippie and make a request it hangs and does nothing until timed out.</p>
  
  <p>So the test call I have is like below with <a href="https://github.com/vesln/hippie" rel="nofollow">Hippie</a>:</p>
  
  <pre><code>    hippie(server)
          .header('token', token)
          .json()
          .put('/token')
          .send(tokenRequest)
          .end(function(err, res, body) {
              if (err) {
                  throw err;
              }
  
              done();
          });
  </code></pre>
  
  <p>Basically token endpoint is linking to token interceptor and that returns next();</p>
  
  <p>How do I make this into testable state?</p>