File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
ServicePulse.Host.Tests/tests/js/views/message
ServicePulse.Host/app/js/views/message Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 6969 expect ( controller . message . retried ) . toEqual ( false ) ;
7070 expect ( serviceControlService . retryFailedMessages ) . toHaveBeenCalled ( ) ;
7171 } ) ;
72+
73+ it ( 'and the headers contain content type, GetContentType returns it' , function ( ) {
74+ var originalValue = 'xml' ;
75+ var headers = [ ] ;
76+ headers . push ( { key : 'NServiceBus.ContentType' , value : originalValue } ) ;
77+ headers . push ( { key : 'bla' , value :1 } ) ;
78+ var headerValue = controller . getContentType ( headers ) ;
79+
80+ expect ( headerValue ) . toEqual ( originalValue ) ;
81+ } ) ;
82+
83+ it ( 'and the headers are empty GetContentType returns null' , function ( ) {
84+ var headers = [ ] ;
85+ var headerValue = controller . getContentType ( headers ) ;
86+
87+ expect ( headerValue ) . toEqual ( null ) ;
88+ } ) ;
7289 } ) ;
7390
7491 describe ( 'when archiving a message' , function ( ) {
Original file line number Diff line number Diff line change 8686 }
8787
8888 function getContentType ( headers ) {
89- return headers . find ( function ( element ) { return element . key === 'NServiceBus.ContentType' ; } ) . value ;
89+ var header = headers . find ( function ( element ) { return element . key === 'NServiceBus.ContentType' ; } ) ;
90+ return header ? header . value : null ;
9091 }
92+
93+ vm . getContentType = getContentType ;
9194
9295 vm . retryMessage = function ( ) {
9396 toastService . showInfo ( "Retrying the message " + vm . message . message_id + " ..." ) ;
You can’t perform that action at this time.
0 commit comments