CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
basic.js42 linesDownload Raw Back to test
1var concat = require('../')2var stream = require('stream')3var test = require('tape')4 5test('basic', function (t) {6  t.plan(2)7  var s = new stream.PassThrough()8  concat(s, function (err, buf) {9    t.error(err)10    t.deepEqual(buf, Buffer.from('abc123456789'))11  })12  s.write('abc')13  setTimeout(function () {14    s.write('123')15  }, 10)16  setTimeout(function () {17    s.write('456')18  }, 20)19  setTimeout(function () {20    s.end('789')21  }, 30)22})23 24test('error', function (t) {25  t.plan(2)26  var s = new stream.PassThrough()27  concat(s, function (err, buf) {28    t.ok(err, 'got expected error')29    t.ok(!buf)30  })31  s.write('abc')32  setTimeout(function () {33    s.write('123')34  }, 10)35  setTimeout(function () {36    s.write('456')37  }, 20)38  setTimeout(function () {39    s.emit('error', new Error('error'))40  }, 30)41})42 
basant307/AI_Governance_Project · CoolFace