我想介绍一下应该断言库,用于我的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()
任何建议如何在实践中做到这一点?
最佳答案
should.myExits = myExists
应该是
should.myExist = myExists