我正在使用mochajs +应该承诺作为测试框架。
我正在尝试测试蓝鸟的承诺,我得到了
Unhandled rejection TypeError: Object #<Assertion> has no method 'indexOf'
at Assertion.<anonymous> ([app path]\node_modules\sh
ould\lib\ext\string.js:22:32)
测试:
obj.certainMethod(opts).should.be.eventually.an.Array();
如果我手动运行该方法,我会得到一个像这样的JSON:
[
{
"_id": "55ce4fc18a051bc4a1aed7f5",
"index": 0,
"guid": "61d6d6a9-5864-4c48-8377-04e9f4260112",
"isActive": true,
"balance": "$3,763.34",
"picture": "http://placehold.it/32x32",
"age": 30,
"range": [1,2,3]
},
{
"_id": "55ce4fc1a5b9b94d9d3888f5",
"index": 1,
"guid": "08f6ce47-997d-453d-a16a-030a28726191",
"isActive": false,
"balance": "$1,805.68",
"picture": "http://placehold.it/32x32",
"age": 31,
"range": [1,2,3]
}
]
关于什么是错的任何想法?