@@ -307,5 +307,27 @@ describe('OpenWhiskInfo', () => {
307307 expect ( log . args [ 3 ] [ 0 ] . match ( / h t t p s : \/ \/ o p e n w h i s k .n g .b l u e m i x .n e t \/ a p i \/ v 1 \/ w e b \/ u s e r _ n a m e \/ c u s t o m _ p a c k a g e \/ s i x t h / ) ) . to . be . ok ;
308308 } ) ) ;
309309 } )
310+
311+ it ( 'should show web action routes returned with apihost that include a protocol' , ( ) => {
312+ const apihost = 'http://localhost'
313+ openwhiskInfo . provider = { props : ( ) => Promise . resolve ( { apihost } ) }
314+ const log = sandbox . stub ( openwhiskInfo , 'consoleLog' )
315+ openwhiskInfo . _actions = [
316+ { name : 'first' , namespace : 'user_name' , annotations : [ { key : 'web-export' , value : true } , { key : 'a' , value : 'b' } ] } ,
317+ { name : 'second' , namespace : 'user_name' , annotations : [ { key : 'web-export' , value : false } ] } ,
318+ { name : 'third' } ,
319+ { name : 'fourth' , namespace : 'user_name' , annotations : [ { key : 'web-export' , value : true } ] } ,
320+ { name : 'fifth' , annotations : [ ] } ,
321+ { name : 'sixth' , namespace : 'user_name/custom_package' , annotations : [ { key : 'web-export' , value : true } ] } ,
322+ ] ;
323+
324+ return expect ( openwhiskInfo . showWebActionsInfo ( ) . then ( ( ) => {
325+ expect ( log . callCount ) . to . be . equal ( 4 ) ;
326+ expect ( log . args [ 0 ] [ 0 ] . match ( / e n d p o i n t s \( w e b a c t i o n s \) : / ) ) . to . be . ok ;
327+ expect ( log . args [ 1 ] [ 0 ] . match ( / h t t p : \/ \/ l o c a l h o s t \/ a p i \/ v 1 \/ w e b \/ u s e r _ n a m e \/ d e f a u l t \/ f i r s t / ) ) . to . be . ok ;
328+ expect ( log . args [ 2 ] [ 0 ] . match ( / h t t p : \/ \/ l o c a l h o s t \/ a p i \/ v 1 \/ w e b \/ u s e r _ n a m e \/ d e f a u l t \/ f o u r t h / ) ) . to . be . ok ;
329+ expect ( log . args [ 3 ] [ 0 ] . match ( / h t t p : \/ \/ l o c a l h o s t \/ a p i \/ v 1 \/ w e b \/ u s e r _ n a m e \/ c u s t o m _ p a c k a g e \/ s i x t h / ) ) . to . be . ok ;
330+ } ) ) ;
331+ } )
310332 } )
311333} ) ;
0 commit comments