我想介绍一下应该断言库,为我的node.js应用程序的测试工作,我的附加功能。
像伪代码
这样的东西should = require "should"
myExists = (obj, msg) ->
# my special exist logic
containSomething = (obj, msg) ->
# my special assert logic
should.myExists = myExists
should.containSomething = containSomething
describe.only "`my extra `", ->
it 'should be working', (done) ->
obj = {}
obj.should.myExists
obj.should.not.myExists
obj.should.containSomething {cool:obj}
obj.should.not.containSomething {cool:obj}
done()
有什么建议在实践中如何做到这一点?
答案 0 :(得分:0)
should.myExits = myExists
应该是
should.myExist = myExists