Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80529 views
1
var test = require('tape');
2
var readonly = require('../');
3
var through = require('through2');
4
var concat = require('concat-stream');
5
6
test('readonly', function (t) {
7
t.plan(2);
8
9
var stream = through();
10
stream.write('woo');
11
12
var ro = readonly(stream);
13
ro.pipe(concat(function (body) {
14
t.equal(body.toString('utf8'), 'woo');
15
}));
16
17
t.throws(function () {
18
ro.write('beep');
19
});
20
21
stream.end();
22
});
23
24