@@ -4,6 +4,7 @@ import { HttpRequest, HttpResponse, RestClient } from './rest-client';
4
4
import { FixtureSet } from './test-utils' ;
5
5
import { HttpTspClient } from './http-tsp-client' ;
6
6
import { DataType } from '../models/data-type' ;
7
+ import { ConfigurationParameterDescriptor } from '../models/configuration-source' ;
7
8
8
9
describe ( 'HttpTspClient Deserialization' , ( ) => {
9
10
@@ -405,22 +406,38 @@ describe('HttpTspClient Deserialization', () => {
405
406
const response = await client . fetchConfigurationSourceTypes ( ) ;
406
407
const sourceTypes = response . getModel ( ) ! ;
407
408
408
- expect ( sourceTypes ) . toHaveLength ( 1 ) ;
409
+ expect ( sourceTypes ) . toHaveLength ( 2 ) ;
409
410
expect ( sourceTypes [ 0 ] . name ) . toEqual ( 'My configuration source 1' ) ;
410
411
expect ( sourceTypes [ 0 ] . description ) . toEqual ( 'My configuration source 1 description' ) ;
411
412
expect ( sourceTypes [ 0 ] . id ) . toEqual ( 'my-source-type-1-id' ) ;
412
- console . log ( sourceTypes [ 0 ] ) ;
413
- expect ( sourceTypes [ 0 ] . parameterDescriptors ) . toHaveLength ( 2 ) ;
414
-
415
- expect ( sourceTypes [ 0 ] . parameterDescriptors [ 0 ] . keyName ) . toEqual ( 'path' ) ;
416
- expect ( sourceTypes [ 0 ] . parameterDescriptors [ 0 ] . description ) . toEqual ( 'path description' ) ;
417
- expect ( sourceTypes [ 0 ] . parameterDescriptors [ 0 ] . dataType ) . toEqual ( 'STRING' ) ;
418
- expect ( sourceTypes [ 0 ] . parameterDescriptors [ 0 ] . isRequired ) . toBeTruthy ( ) ;
419
-
420
- expect ( sourceTypes [ 0 ] . parameterDescriptors [ 1 ] . keyName ) . toEqual ( 'test1' ) ;
421
- expect ( sourceTypes [ 0 ] . parameterDescriptors [ 1 ] . description ) . toBeUndefined ( ) ;
422
- expect ( sourceTypes [ 0 ] . parameterDescriptors [ 1 ] . dataType ) . toBeUndefined ( ) ;
423
- expect ( sourceTypes [ 0 ] . parameterDescriptors [ 1 ] . isRequired ) . toBeUndefined ( ) ;
413
+
414
+ expect ( sourceTypes [ 0 ] . parameterDescriptors ) . toBeDefined ( ) ;
415
+ const paramDesc : ConfigurationParameterDescriptor [ ] = sourceTypes [ 0 ] . parameterDescriptors ?? [ ] ;
416
+ expect ( paramDesc ) . toHaveLength ( 2 ) ;
417
+
418
+ expect ( paramDesc [ 0 ] . keyName ) . toEqual ( 'path' ) ;
419
+ expect ( paramDesc [ 0 ] . description ) . toEqual ( 'path description' ) ;
420
+ expect ( paramDesc [ 0 ] . dataType ) . toEqual ( 'STRING' ) ;
421
+ expect ( paramDesc [ 0 ] . isRequired ) . toBeTruthy ( ) ;
422
+
423
+ expect ( paramDesc [ 1 ] . keyName ) . toEqual ( 'test1' ) ;
424
+ expect ( paramDesc [ 1 ] . description ) . toBeUndefined ( ) ;
425
+ expect ( paramDesc [ 1 ] . dataType ) . toBeUndefined ( ) ;
426
+ expect ( paramDesc [ 1 ] . isRequired ) . toBeUndefined ( ) ;
427
+ expect ( sourceTypes [ 0 ] . schema ) . toBeUndefined ( ) ;
428
+
429
+ expect ( sourceTypes [ 1 ] . parameterDescriptors ) . toBeUndefined ( ) ;
430
+ expect ( sourceTypes [ 1 ] . schema ) . toBeDefined ( ) ;
431
+ const schema : { } = sourceTypes [ 1 ] . schema ?? { }
432
+ const schemaString : string = JSON . stringify ( schema ) ;
433
+ expect ( schemaString ) . toBeDefined ( ) ;
434
+
435
+ // check some scheme content
436
+ expect ( schema [ '$schema' ] ) . toBeDefined ( ) ;
437
+ expect ( schema [ '$schema' ] ) . toEqual ( 'https://json-schema.org/draft/2020-12/schema' )
438
+
439
+ expect ( schema [ '$id' ] ) . toBeDefined ( ) ;
440
+ expect ( schema [ '$id' ] ) . toEqual ( 'https://org.eclipse.tracecompass/custom-execution-analysis.json' )
424
441
} ) ;
425
442
426
443
it ( 'configurations' , async ( ) => {
0 commit comments