@@ -394,17 +394,35 @@ suite("odo", () => {
394
394
} ) ;
395
395
396
396
suite ( "catalog integration" , ( ) => {
397
- const http = 'httpd' ;
398
397
const nodejs = 'nodejs' ;
399
- const python = 'python' ;
400
-
401
- const odoCatalog : string = [
402
- `NAME PROJECT TAGS` ,
403
- `${ nodejs } openshift 1.0` ,
404
- `${ python } openshift 1.0,2.0` ,
405
- `${ http } openshift 2.2,2.3,latest`
406
- ] . join ( '\n' ) ;
407
- let result : string [ ] ;
398
+
399
+ const odoCatalog = JSON . stringify ( {
400
+ kind : "ComponentTypeList" ,
401
+ apiVersion : "odo.openshift.io/v1alpha1" ,
402
+ items : [
403
+ {
404
+ kind : "ComponentType" ,
405
+ apiVersion : "odo.openshift.io/v1alpha1" ,
406
+ metadata : {
407
+ name : "nodejs" ,
408
+ namespace : "openshift" ,
409
+ creationTimestamp : null
410
+ } ,
411
+ spec : {
412
+ allTags : [
413
+ "0.10" ,
414
+ "10" ,
415
+ "4" ,
416
+ "6" ,
417
+ "8" ,
418
+ "8-RHOAR" ,
419
+ "latest" ,
420
+ ]
421
+ }
422
+ }
423
+ ]
424
+ } ) ;
425
+
408
426
const catalogData : CliExitData = {
409
427
error : null ,
410
428
stderr : '' ,
@@ -413,32 +431,19 @@ suite("odo", () => {
413
431
414
432
setup ( async ( ) => {
415
433
sandbox . stub ( odo . OdoImpl . prototype , 'execute' ) . resolves ( catalogData ) ;
416
- result = await odoCli . getComponentTypes ( ) ;
417
434
} ) ;
418
435
419
- test ( "getComponentTypes returns correct number of component types" , ( ) => {
420
- assert . equal ( result . length , 3 ) ;
436
+ test ( "getComponentTypes returns correct component type names" , async ( ) => {
437
+ const result = await odoCli . getComponentTypes ( ) ;
438
+ expect ( result . length ) . equals ( 1 ) ;
439
+ expect ( result [ 0 ] ) . equals ( 'nodejs' ) ;
421
440
} ) ;
422
441
423
- test ( "getComponentTypes returns correct component type names" , ( ) => {
424
- const resultArray = result . filter ( ( element : string ) => {
425
- return element === http || element === nodejs || element === python ;
426
- } ) ;
427
- assert . equal ( resultArray . length , 3 ) ;
428
- } ) ;
429
-
430
- test ( "getComponentTypeVersions returns correct number of tags for component type" , ( ) => {
431
- return Promise . all ( [
432
- odoCli . getComponentTypeVersions ( nodejs ) . then ( ( result ) => {
433
- assert . equal ( result . length , 1 ) ;
434
- } ) ,
435
- odoCli . getComponentTypeVersions ( python ) . then ( ( result ) => {
436
- assert . equal ( result . length , 2 ) ;
437
- } ) ,
438
- odoCli . getComponentTypeVersions ( http ) . then ( ( result ) => {
439
- assert . equal ( result . length , 3 ) ;
440
- } )
441
- ] ) ;
442
+ test ( "getComponentTypeVersions returns correct number of tags for component type" , async ( ) => {
443
+ const result = await odoCli . getComponentTypeVersions ( nodejs ) ;
444
+ expect ( result . length ) . equals ( 7 ) ;
445
+ expect ( result [ 0 ] ) . equals ( "0.10" ) ;
446
+ expect ( result [ 6 ] ) . equals ( "latest" ) ;
442
447
} ) ;
443
448
} ) ;
444
449
0 commit comments