aboutsummaryrefslogtreecommitdiff
path: root/node_modules/gulp-util/node_modules/vinyl/test/inspectStream.js
blob: fe1802c5d7155d9838c2c644c7d3d12a4b336146 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
var inspectStream = require('../lib/inspectStream');
var Stream = require('stream');
var should = require('should');
require('mocha');

describe('inspectStream()', function() {
  it('should work on a core Stream', function(done) {
    var testStream = new Stream();
    inspectStream(testStream).should.equal('<Stream>');
    done();
  });

  it('should work on a core Readable Stream', function(done) {
    var testStream = new Stream.Readable();
    inspectStream(testStream).should.equal('<ReadableStream>');
    done();
  });

  it('should work on a core Writable Stream', function(done) {
    var testStream = new Stream.Writable();
    inspectStream(testStream).should.equal('<WritableStream>');
    done();
  });

  it('should work on a core Duplex Stream', function(done) {
    var testStream = new Stream.Duplex();
    inspectStream(testStream).should.equal('<DuplexStream>');
    done();
  });

  it('should work on a core Transform Stream', function(done) {
    var testStream = new Stream.Transform();
    inspectStream(testStream).should.equal('<TransformStream>');
    done();
  });

  it('should work on a core PassThrough Stream', function(done) {
    var testStream = new Stream.PassThrough();
    inspectStream(testStream).should.equal('<PassThroughStream>');
    done();
  });

  it('should not work on a Buffer', function(done) {
    var testBuffer = new Buffer('test');
    should.not.exist(inspectStream(testBuffer));
    done();
  });

  it('should not work on a null', function(done) {
    should.not.exist(inspectStream(null));
    done();
  });
});