我使用摩卡/ supertest/should.js来测试我的REST服务断言具有相同内容
GET /files/<hash>
回报文件作为流文件。
如何在should.js中声明文件内容相同?
it('should return file as stream', function (done) {
var writeStream = fs.createWriteStream('test/fixtures/tmp.json');
var req = api.get('/files/676dfg1430af3595');
req.on('end', function(){
var tmpBuf = fs.readFileSync('test/fixtures/tmp.json');
var testBuf = fs.readFileSync('test/fixtures/test.json');
// How to assert with should.js file contents are the same (tmpBuf == testBuf)
// ...
done();
});
});