SuperTest的期待与Chai.expect

我很困惑,所以如果我使用SuperTest ,看起来好像有自己的期望断言,那么我不需要担心使用Chai? 或者当我需要柴时,Supertest知道它并且正在使用它作为期望机制?

SuperTest扩展SuperAgent的request对象以包含expect函数。 它不像Chai的expect断言那样工作,但是可以用来断言http响应状态和头部,并且可以与Chai的expect混在一起。

 request(app). get('/'). expect(200). // request.expect, is status code 200? expect('Content-Type', /json/). // request.expect, does content-type match regex /json/? expect(function(res){ // request.expect, does this user-provided function throw? // user-provided function can include Chai assertions expect(res.body).to.exist; expect(res.body).to.have.property('status'); }). end(done);