@@ -28,25 +28,33 @@ describe("<ResponseBody />", function () {
2828 it ( "renders ResponseBody as 'image/svg'" , function ( ) {
2929 props . contentType = "image/svg"
3030 const wrapper = shallow ( < ResponseBody { ...props } /> )
31- console . warn ( wrapper . debug ( ) )
3231 expect ( wrapper . find ( "highlightCodeComponent" ) . length ) . toEqual ( 0 )
3332 } )
3433
3534 it ( "should render a copyable highlightCodeComponent for text types" , function ( ) {
3635 props . contentType = "text/plain"
3736 props . content = "test text"
3837 const wrapper = shallow ( < ResponseBody { ...props } /> )
39- console . warn ( wrapper . debug ( ) )
4038 expect ( wrapper . find ( "highlightCodeComponent[canCopy]" ) . length ) . toEqual ( 1 )
4139 } )
4240
43- it ( "should render Download file link for non-empty response" , function ( ) {
41+ it ( "should render Download file link for non-empty Blob response" , function ( ) {
4442 props . contentType = "application/octet-stream"
4543 props . content = new Blob ( [ "\"test\"" ] , { type : props . contentType } )
4644 const wrapper = shallow ( < ResponseBody { ...props } /> )
4745 expect ( wrapper . text ( ) ) . toMatch ( / D o w n l o a d f i l e / )
4846 } )
4947
48+ it ( "should render Download file link for non-empty text response" , function ( ) {
49+ props . contentType = "text/plain"
50+ props . content = "test text"
51+ props . headers = {
52+ "Content-Disposition" : "attachment; filename=\"test.txt\"" ,
53+ }
54+ const wrapper = shallow ( < ResponseBody { ...props } /> )
55+ expect ( wrapper . text ( ) ) . toMatch ( / D o w n l o a d f i l e / )
56+ } )
57+
5058 it ( "should not render Download file link for empty response" , function ( ) {
5159 props . contentType = "application/octet-stream"
5260 props . content = new Blob ( )
0 commit comments