【发布时间】:2014-02-08 23:29:42
【问题描述】:
我正在编写一个节点包装器来与 external api 交互,并且在测试异步 createJob 方法时遇到了困难。下面是测试用例代码:
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", ->
@timeout(50000)
describe "create", ->
it "should create a job with address_id", (done) ->
lob.jobs.createJob data, (new_job) ->
new_job.should.not.be.empty
new_job['name'].should.equal(data['name'])
done()
编辑
以上代码解决了问题
【问题讨论】:
标签: javascript node.js testing coffeescript mocha.js