title: node.js unit test to check that a token is expired after the set time
body: <p>I want to be able to test that a token will expire after the defined interval when creating the token.</p>
  
  <p>this is my code using json-web-token module:</p>
  
  <pre><code>var generateToken = function (uid, callback) {
      var token = jwt.sign({ uid: uid }, secret, {expiresInMinutes: 60});
      callback(null, token);
  };
  </code></pre>
  
  <p>this is my verify function:</p>
  
  <pre><code>var authenticate = function (token, callback) {
      jwt.verify(token, secret, function(err, decoded){
          if (err)
              callback(err);
          else
              callback(null, decoded);
      });
  };
  </code></pre>
  
  <p>how can i write a test with mocha to mock(simulate) a time difference of 60 minutes so i will be able to see that the token will expire when trying to verify it.</p>