@@ -60,6 +60,7 @@ describe('OutputResponse', () => {
60
60
assert . doesNotThrow ( ( ) => {
61
61
new OutputResponse ( ) ;
62
62
new OutputResponse ( testOptions ) ;
63
+ new OutputResponse ( testOptions , { } ) ;
63
64
} ) ;
64
65
} ) ;
65
66
} ) ;
@@ -111,7 +112,7 @@ describe('OutputResponse', () => {
111
112
diagnosticOptions . spy . diagnosticStatusCode = spyOn ( diagnosticOptions , 'diagnosticStatusCode' ) ;
112
113
113
114
assert . throws ( ( ) => new OutputResponse ( diagnosticOptions ) . flush ( ) ,
114
- { message : 'statusCode error' } ) ;
115
+ { message : 'statusCode error' , cause : 'INVALID_RESPONSE' } ) ;
115
116
116
117
expect ( diagnosticOptions . spy . diagnosticBody ) . toHaveBeenCalledTimes ( 0 ) ;
117
118
expect ( diagnosticOptions . spy . diagnosticStatusCode ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -125,7 +126,7 @@ describe('OutputResponse', () => {
125
126
diagnosticOptions . spy . diagnosticHeaders = spyOn ( diagnosticOptions , 'diagnosticHeaders' ) ;
126
127
127
128
assert . throws ( ( ) => new OutputResponse ( diagnosticOptions ) . flush ( ) ,
128
- { message : 'headers error' } ) ;
129
+ { message : 'headers error' , cause : 'INVALID_RESPONSE' } ) ;
129
130
130
131
expect ( diagnosticOptions . spy . diagnosticBody ) . toHaveBeenCalledTimes ( 0 ) ;
131
132
expect ( diagnosticOptions . spy . diagnosticStatusCode ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -139,7 +140,7 @@ describe('OutputResponse', () => {
139
140
diagnosticOptions . spy . diagnosticBody = spyOn ( diagnosticOptions , 'diagnosticBody' ) ;
140
141
141
142
assert . throws ( ( ) => new OutputResponse ( diagnosticOptions ) . flush ( ) ,
142
- { message : 'body error' } ) ;
143
+ { message : 'body error' , cause : 'INVALID_RESPONSE' } ) ;
143
144
144
145
expect ( diagnosticOptions . spy . diagnosticBody ) . toHaveBeenCalledTimes ( 1 ) ;
145
146
expect ( diagnosticOptions . spy . diagnosticStatusCode ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -162,6 +163,17 @@ describe('OutputResponse', () => {
162
163
} ) ) ;
163
164
} ) ;
164
165
166
+ test ( 'should not be updated' , ( ) => {
167
+ const resultedOutputStream = new OutputResponse ( testOptions )
168
+ . update ( ) . flush ( ) ;
169
+
170
+ assert . deepStrictEqual ( resultedOutputStream ,
171
+ new Response ( testOptions . body , {
172
+ status : testOptions . statusCode ,
173
+ headers : testOptions . headers
174
+ } ) ) ;
175
+ } ) ;
176
+
165
177
test ( 'should be updated by statusCode, body and headers' , ( ) => {
166
178
const resultedOutputStream = new OutputResponse ( )
167
179
. update ( testOptions ) . flush ( ) ;
0 commit comments