@@ -601,137 +601,6 @@ describe('File', function() {
601
601
} ) ;
602
602
} ) ;
603
603
604
- describe ( 'pipe()' , function ( ) {
605
- it ( 'should write to stream with Buffer' , function ( done ) {
606
- var options = {
607
- cwd : '/' ,
608
- base : '/test/' ,
609
- path : '/test/test.coffee' ,
610
- contents : new Buffer ( 'test' ) ,
611
- } ;
612
- var file = new File ( options ) ;
613
- var stream = new Stream . PassThrough ( ) ;
614
- stream . on ( 'data' , function ( chunk ) {
615
- should . exist ( chunk ) ;
616
- ( chunk instanceof Buffer ) . should . equal ( true , 'should write as a buffer' ) ;
617
- chunk . toString ( 'utf8' ) . should . equal ( options . contents . toString ( 'utf8' ) ) ;
618
- } ) ;
619
- stream . on ( 'end' , function ( ) {
620
- done ( ) ;
621
- } ) ;
622
- var ret = file . pipe ( stream ) ;
623
- ret . should . equal ( stream , 'should return the stream' ) ;
624
- } ) ;
625
-
626
- it ( 'should pipe to stream with Stream' , function ( done ) {
627
- var testChunk = new Buffer ( 'test' ) ;
628
- var options = {
629
- cwd : '/' ,
630
- base : '/test/' ,
631
- path : '/test/test.coffee' ,
632
- contents : new Stream . PassThrough ( ) ,
633
- } ;
634
- var file = new File ( options ) ;
635
- var stream = new Stream . PassThrough ( ) ;
636
- stream . on ( 'data' , function ( chunk ) {
637
- should . exist ( chunk ) ;
638
- ( chunk instanceof Buffer ) . should . equal ( true , 'should write as a buffer' ) ;
639
- chunk . toString ( 'utf8' ) . should . equal ( testChunk . toString ( 'utf8' ) ) ;
640
- done ( ) ;
641
- } ) ;
642
- var ret = file . pipe ( stream ) ;
643
- ret . should . equal ( stream , 'should return the stream' ) ;
644
-
645
- file . contents . write ( testChunk ) ;
646
- } ) ;
647
-
648
- it ( 'should do nothing with null' , function ( done ) {
649
- var options = {
650
- cwd : '/' ,
651
- base : '/test/' ,
652
- path : '/test/test.coffee' ,
653
- contents : null ,
654
- } ;
655
- var file = new File ( options ) ;
656
- var stream = new Stream . PassThrough ( ) ;
657
- stream . on ( 'data' , function ( ) {
658
- throw new Error ( 'should not write' ) ;
659
- } ) ;
660
- stream . on ( 'end' , function ( ) {
661
- done ( ) ;
662
- } ) ;
663
- var ret = file . pipe ( stream ) ;
664
- ret . should . equal ( stream , 'should return the stream' ) ;
665
- } ) ;
666
-
667
- it ( 'should write to stream with Buffer' , function ( done ) {
668
- var options = {
669
- cwd : '/' ,
670
- base : '/test/' ,
671
- path : '/test/test.coffee' ,
672
- contents : new Buffer ( 'test' ) ,
673
- } ;
674
- var file = new File ( options ) ;
675
- var stream = new Stream . PassThrough ( ) ;
676
- stream . on ( 'data' , function ( chunk ) {
677
- should . exist ( chunk ) ;
678
- ( chunk instanceof Buffer ) . should . equal ( true , 'should write as a buffer' ) ;
679
- chunk . toString ( 'utf8' ) . should . equal ( options . contents . toString ( 'utf8' ) ) ;
680
- done ( ) ;
681
- } ) ;
682
- stream . on ( 'end' , function ( ) {
683
- throw new Error ( 'should not end' ) ;
684
- } ) ;
685
- var ret = file . pipe ( stream , { end : false } ) ;
686
- ret . should . equal ( stream , 'should return the stream' ) ;
687
- } ) ;
688
-
689
- it ( 'should pipe to stream with Stream' , function ( done ) {
690
- var testChunk = new Buffer ( 'test' ) ;
691
- var options = {
692
- cwd : '/' ,
693
- base : '/test/' ,
694
- path : '/test/test.coffee' ,
695
- contents : new Stream . PassThrough ( ) ,
696
- } ;
697
- var file = new File ( options ) ;
698
- var stream = new Stream . PassThrough ( ) ;
699
- stream . on ( 'data' , function ( chunk ) {
700
- should . exist ( chunk ) ;
701
- ( chunk instanceof Buffer ) . should . equal ( true , 'should write as a buffer' ) ;
702
- chunk . toString ( 'utf8' ) . should . equal ( testChunk . toString ( 'utf8' ) ) ;
703
- done ( ) ;
704
- } ) ;
705
- stream . on ( 'end' , function ( ) {
706
- throw new Error ( 'should not end' ) ;
707
- } ) ;
708
- var ret = file . pipe ( stream , { end : false } ) ;
709
- ret . should . equal ( stream , 'should return the stream' ) ;
710
-
711
- file . contents . write ( testChunk ) ;
712
- } ) ;
713
-
714
- it ( 'should do nothing with null' , function ( done ) {
715
- var options = {
716
- cwd : '/' ,
717
- base : '/test/' ,
718
- path : '/test/test.coffee' ,
719
- contents : null ,
720
- } ;
721
- var file = new File ( options ) ;
722
- var stream = new Stream . PassThrough ( ) ;
723
- stream . on ( 'data' , function ( ) {
724
- throw new Error ( 'should not write' ) ;
725
- } ) ;
726
- stream . on ( 'end' , function ( ) {
727
- throw new Error ( 'should not end' ) ;
728
- } ) ;
729
- var ret = file . pipe ( stream , { end : false } ) ;
730
- ret . should . equal ( stream , 'should return the stream' ) ;
731
- process . nextTick ( done ) ;
732
- } ) ;
733
- } ) ;
734
-
735
604
describe ( 'inspect()' , function ( ) {
736
605
it ( 'should return correct format when no contents and no path' , function ( done ) {
737
606
var file = new File ( ) ;
0 commit comments