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