@@ -24,7 +24,7 @@ var buf1 = new Buffer("asdfasd"),
24
24
buf3 = new Buffer ( 542 ) ,
25
25
buf4 = new Buffer ( "93jfemialfjkasjlfas" ) ;
26
26
27
- test ( 'stream has to finish data stream to connection exactly once ' , function ( ) {
27
+ test ( 'CopyFromStream, start streaming before data, end after data. no drain event ' , function ( ) {
28
28
var stream = new CopyFromStream ( ) ;
29
29
var conn = new ConnectionImitation ( ) ;
30
30
stream . on ( 'drain' , function ( ) {
@@ -38,8 +38,9 @@ test('stream has to finish data stream to connection exactly once', function ()
38
38
stream . end ( conn . updateHasToBeSend ( buf4 ) ) ;
39
39
assert . ok ( ! stream . writable , "stream has not to be writable" ) ;
40
40
stream . end ( ) ;
41
+ assert . equal ( conn . hasToBeSend , conn . send ) ;
41
42
} ) ;
42
- test ( '' , function ( ) {
43
+ test ( 'CopyFromStream, start streaming after end, end after data. drain event ' , function ( ) {
43
44
var stream = new CopyFromStream ( ) ;
44
45
assert . emits ( stream , 'drain' , function ( ) { } , 'drain have to be emitted' ) ;
45
46
var conn = new ConnectionImitation ( )
@@ -51,8 +52,9 @@ test('', function () {
51
52
assert . ok ( ! stream . writable , "stream has not to be writable" ) ;
52
53
stream . end ( ) ;
53
54
stream . startStreamingToConnection ( conn ) ;
55
+ assert . equal ( conn . hasToBeSend , conn . send ) ;
54
56
} ) ;
55
- test ( '' , function ( ) {
57
+ test ( 'CopyFromStream, start streaming between data chunks. end after data. drain event ' , function ( ) {
56
58
var stream = new CopyFromStream ( ) ;
57
59
var conn = new ConnectionImitation ( )
58
60
assert . emits ( stream , 'drain' , function ( ) { } , 'drain have to be emitted' ) ;
@@ -62,10 +64,11 @@ test('', function () {
62
64
stream . write ( conn . updateHasToBeSend ( buf3 ) ) ;
63
65
assert . ok ( stream . writable , "stream has to be writable" ) ;
64
66
stream . end ( conn . updateHasToBeSend ( buf4 ) ) ;
67
+ assert . equal ( conn . hasToBeSend , conn . send ) ;
65
68
assert . ok ( ! stream . writable , "stream has not to be writable" ) ;
66
69
stream . end ( ) ;
67
70
} ) ;
68
- test ( '' , function ( ) {
71
+ test ( 'CopyFromStream, start sreaming before end. end stream with data. drain event ' , function ( ) {
69
72
var stream = new CopyFromStream ( ) ;
70
73
var conn = new ConnectionImitation ( )
71
74
assert . emits ( stream , 'drain' , function ( ) { } , 'drain have to be emitted' ) ;
@@ -75,10 +78,11 @@ test('', function () {
75
78
stream . startStreamingToConnection ( conn ) ;
76
79
assert . ok ( stream . writable , "stream has to be writable" ) ;
77
80
stream . end ( conn . updateHasToBeSend ( buf4 ) ) ;
81
+ assert . equal ( conn . hasToBeSend , conn . send ) ;
78
82
assert . ok ( ! stream . writable , "stream has not to be writable" ) ;
79
83
stream . end ( ) ;
80
84
} ) ;
81
- test ( '' , function ( ) {
85
+ test ( 'CopyFromStream, start streaming after end. end with data. drain event ' , function ( ) {
82
86
var stream = new CopyFromStream ( ) ;
83
87
var conn = new ConnectionImitation ( )
84
88
assert . emits ( stream , 'drain' , function ( ) { } , 'drain have to be emitted' ) ;
@@ -89,6 +93,7 @@ test('', function(){
89
93
assert . ok ( stream . writable , "stream has to be writable" ) ;
90
94
stream . end ( conn . updateHasToBeSend ( buf4 ) ) ;
91
95
stream . startStreamingToConnection ( conn ) ;
96
+ assert . equal ( conn . hasToBeSend , conn . send ) ;
92
97
assert . ok ( ! stream . writable , "stream has not to be writable" ) ;
93
98
stream . end ( ) ;
94
99
} ) ;
0 commit comments