摩卡和柴:写作断言
我正在使用摩卡和柴第一次写testing用例。 这是我的服务返回的非常简单的响应:
{ "success": true, "message": "Done" }
我写过这样的断言:
describe('GET /TestService', function() { it('should run successfully.', function(done) { request .get('/myApp/TestService/') .expect(200) .expect('Content-Type', 'application/json') .end(function(err, res) { expect(res.body.success).to.equal(true); expect(res.body.message).to.equal('Done'); }); }); });
当我执行testing时,它返回: Uncaught AssertionError:预计未定义为等于true
这有什么问题? 这是我第一次遇到摩卡和柴。 也许我错过了一个非常基本的东西。 这只是第一步。 有人能推我吗?