我正在尝试测试我的mongoose
模型:
Todo =要求“../../../ app / todos / Todo”
describe "Todo", ->
describe "Basic CRUD", ->
before: (done) ->
console.log "In b4"
Todo.remove {}, (err) ->
console.log "removed"
done err
it "can be added to database", (done) ->
todo = new Todo
title: "New todo"
todo.save (err) ->
if !err
Todo.find { title: "New todo" }, (err, docs) ->
docs.length.should.equal 1
done(err)
else
done err
出于某种原因,before
或beforeEach
没有触发,为什么会这样?
答案 0 :(得分:2)
似乎你之前我的情况不正确。
之前应删除':'...应该是:
before (done) ->
console.log 'In b4'