title: Mocha tests for asynchronous functions
body: <p>I'm writing a node wrapper to interact with an <a href="https://www.lob.com/" rel="nofollow">external api</a> and am having a difficult time testing the asynchronous <code>createJob</code> method. Below is the test case code:</p>
  
  <pre><code>api_key = "test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc"
  
  lob     = require('../src/lob')(api_key)
  should  = require("should")
  chai    = require("chai")
  
  data = 
    name: "test name"
    to: "Bob"
    from: "Alice"
    object1: "foo"
    object2: "bar"
  
  describe "Job", -&gt;
    @timeout(50000)
    describe "create", -&gt;
      it "should create a job with address_id", (done) -&gt;
        lob.jobs.createJob data, (new_job) -&gt;
          new_job.should.not.be.empty
          new_job['name'].should.equal(data['name'])
          done()
  </code></pre>
  
  <p><strong>Edit</strong></p>
  
  <p>The above code resolves the issue</p>