File: ro.js

package info (click to toggle)
node-read-only-stream 2.0.0-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 112 kB
  • sloc: javascript: 81; makefile: 12
file content (22 lines) | stat: -rw-r--r-- 461 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
var test = require('tape');
var readonly = require('../');
var through = require('through2');
var concat = require('concat-stream');

test('readonly', function (t) {
    t.plan(2);
    
    var stream = through();
    stream.write('woo');
    
    var ro = readonly(stream);
    ro.pipe(concat(function (body) {
        t.equal(body.toString('utf8'), 'woo');
    }));
    
    t.throws(function () {
        ro.write('beep');
    });
    
    stream.end();
});