如何为以下代码编写Mocha Chai测试用例

时间:2019-12-19 07:38:11

标签: unit-testing google-cloud-platform google-cloud-functions sinon sinon-chai

有人可以帮我编写下面的代码的测试用例吗,

    function abc(req, res){
       const bucketName = "abc-xyz"
        const fileName = "Sample.json"
        var file = storage.bucket(bucketName).file(fileName);
        const myfile = file.createReadStream();
        var  buffer = '';
        myfile.on('data', function(a) {
          buffer += a;
        }).on('end', function() {
          console.log(buffer)
           res.send(buffer)
        });
 }

0 个答案:

没有答案