@@ -482,5 +482,168 @@ describe("InputService", () => {
482482 expect ( inputs . numberOfNodes ) . toBeNaN ( ) ;
483483 } ) ;
484484 } ) ;
485+
486+ describe ( "autoscale" , ( ) => {
487+ it ( "should return true when autoscale input is not provided" , ( ) => {
488+ getInputMock . mockImplementation ( ( inputName ) => {
489+ switch ( inputName ) {
490+ case InputNames . ProjectId :
491+ return "project-123" ;
492+ case InputNames . ClusterId :
493+ return "cluster-123" ;
494+ case InputNames . NodepoolId :
495+ return "nodepool-456" ;
496+ case InputNames . NumberOfNodes :
497+ return "3" ;
498+ case InputNames . Autoscale :
499+ return "" ;
500+ default :
501+ return "" ;
502+ }
503+ } ) ;
504+
505+ const inputs = service . getInputs ( ) ;
506+
507+ expect ( inputs . autoscale ) . toBe ( true ) ;
508+ } ) ;
509+
510+ it ( "should return true when autoscale input is 'true'" , ( ) => {
511+ getInputMock . mockImplementation ( ( inputName ) => {
512+ switch ( inputName ) {
513+ case InputNames . ProjectId :
514+ return "project-123" ;
515+ case InputNames . ClusterId :
516+ return "cluster-123" ;
517+ case InputNames . NodepoolId :
518+ return "nodepool-456" ;
519+ case InputNames . NumberOfNodes :
520+ return "3" ;
521+ case InputNames . Autoscale :
522+ return "true" ;
523+ default :
524+ return "" ;
525+ }
526+ } ) ;
527+
528+ const inputs = service . getInputs ( ) ;
529+
530+ expect ( inputs . autoscale ) . toBe ( true ) ;
531+ } ) ;
532+
533+ it ( "should return false when autoscale input is 'false'" , ( ) => {
534+ getInputMock . mockImplementation ( ( inputName ) => {
535+ switch ( inputName ) {
536+ case InputNames . ProjectId :
537+ return "project-123" ;
538+ case InputNames . ClusterId :
539+ return "cluster-123" ;
540+ case InputNames . NodepoolId :
541+ return "nodepool-456" ;
542+ case InputNames . NumberOfNodes :
543+ return "3" ;
544+ case InputNames . Autoscale :
545+ return "false" ;
546+ default :
547+ return "" ;
548+ }
549+ } ) ;
550+
551+ const inputs = service . getInputs ( ) ;
552+
553+ expect ( inputs . autoscale ) . toBe ( false ) ;
554+ } ) ;
555+ } ) ;
556+
557+ describe ( "min-nodes" , ( ) => {
558+ it ( "should return null when min-nodes input is not provided" , ( ) => {
559+ getInputMock . mockImplementation ( ( inputName ) => {
560+ switch ( inputName ) {
561+ case InputNames . ProjectId :
562+ return "project-123" ;
563+ case InputNames . ClusterId :
564+ return "cluster-123" ;
565+ case InputNames . NodepoolId :
566+ return "nodepool-456" ;
567+ case InputNames . NumberOfNodes :
568+ return "3" ;
569+ default :
570+ return "" ;
571+ }
572+ } ) ;
573+
574+ const inputs = service . getInputs ( ) ;
575+
576+ expect ( inputs . minNodes ) . toBeNull ( ) ;
577+ } ) ;
578+
579+ it ( "should return given min-nodes input as number" , ( ) => {
580+ getInputMock . mockImplementation ( ( inputName ) => {
581+ switch ( inputName ) {
582+ case InputNames . ProjectId :
583+ return "project-123" ;
584+ case InputNames . ClusterId :
585+ return "cluster-123" ;
586+ case InputNames . NodepoolId :
587+ return "nodepool-456" ;
588+ case InputNames . NumberOfNodes :
589+ return "3" ;
590+ case InputNames . MinNodes :
591+ return "1" ;
592+ default :
593+ return "" ;
594+ }
595+ } ) ;
596+
597+ const inputs = service . getInputs ( ) ;
598+
599+ expect ( inputs . minNodes ) . toEqual ( 1 ) ;
600+ } ) ;
601+ } ) ;
602+
603+ describe ( "max-nodes" , ( ) => {
604+ it ( "should return null when max-nodes input is not provided" , ( ) => {
605+ getInputMock . mockImplementation ( ( inputName ) => {
606+ switch ( inputName ) {
607+ case InputNames . ProjectId :
608+ return "project-123" ;
609+ case InputNames . ClusterId :
610+ return "cluster-123" ;
611+ case InputNames . NodepoolId :
612+ return "nodepool-456" ;
613+ case InputNames . NumberOfNodes :
614+ return "3" ;
615+ default :
616+ return "" ;
617+ }
618+ } ) ;
619+
620+ const inputs = service . getInputs ( ) ;
621+
622+ expect ( inputs . maxNodes ) . toBeNull ( ) ;
623+ } ) ;
624+
625+ it ( "should return given max-nodes input as number" , ( ) => {
626+ getInputMock . mockImplementation ( ( inputName ) => {
627+ switch ( inputName ) {
628+ case InputNames . ProjectId :
629+ return "project-123" ;
630+ case InputNames . ClusterId :
631+ return "cluster-123" ;
632+ case InputNames . NodepoolId :
633+ return "nodepool-456" ;
634+ case InputNames . NumberOfNodes :
635+ return "3" ;
636+ case InputNames . MaxNodes :
637+ return "10" ;
638+ default :
639+ return "" ;
640+ }
641+ } ) ;
642+
643+ const inputs = service . getInputs ( ) ;
644+
645+ expect ( inputs . maxNodes ) . toEqual ( 10 ) ;
646+ } ) ;
647+ } ) ;
485648 } ) ;
486649} ) ;
0 commit comments