@@ -510,6 +510,77 @@ describe('OpenAPI EventCatalog Plugin', () => {
510510
511511 expect ( service ) . toBeDefined ( ) ;
512512 } ) ;
513+
514+ it ( '[id] if the `id` not provided in the service config options, The generator throw an explicit error' , async ( ) => {
515+ await expect (
516+ plugin ( config , {
517+ services : [
518+ {
519+ path : join ( openAPIExamples , 'petstore.yml' ) ,
520+ } as any ,
521+ ] ,
522+ } )
523+ ) . rejects . toThrow ( 'The service id is required' ) ;
524+ } ) ;
525+ it ( '[services] if the `services` not provided in options, The generator throw an explicit error' , async ( ) => {
526+ await expect ( plugin ( config , { } as any ) ) . rejects . toThrow ( 'Please provide correct services configuration' ) ;
527+ } ) ;
528+ it ( '[services] if the `services` is undefiend in options, The generator throw an explicit error' , async ( ) => {
529+ await expect ( plugin ( config , { services : undefined } as any ) ) . rejects . toThrow (
530+ 'Please provide correct services configuration'
531+ ) ;
532+ } ) ;
533+ it ( '[services::path] if the `services::path` not provided in options, The generator throw an explicit error' , async ( ) => {
534+ await expect ( plugin ( config , { services : [ { id : 'service_id' } ] } as any ) ) . rejects . toThrow (
535+ 'The service path is required. please provide the path to specification file'
536+ ) ;
537+ } ) ;
538+ it ( '[services::id] if the `services::id` not provided in options, The generator throw an explicit error' , async ( ) => {
539+ await expect ( plugin ( config , { services : [ { path : 'path/to/spec' } ] } as any ) ) . rejects . toThrow (
540+ 'The service id is required. please provide the service id'
541+ ) ;
542+ } ) ;
543+ it ( '[path] if the `path` not provided in service config options, The generator throw an explicit error' , async ( ) => {
544+ await expect (
545+ plugin ( config , {
546+ services : [
547+ {
548+ name : 'Awesome account service' ,
549+ id : 'awsome-service' ,
550+ } as any ,
551+ ] ,
552+ } )
553+ ) . rejects . toThrow ( 'The service path is required. please provide the path to specification file' ) ;
554+ } ) ;
555+ it ( '[services::saveParsedSpecFile] if the `services::saveParsedSpecFile` not a boolean in options, The generator throw an explicit error' , async ( ) => {
556+ await expect (
557+ plugin ( config , { services : [ { path : 'path/to/spec' , id : 'sevice_id' } ] , saveParsedSpecFile : 'true' } as any )
558+ ) . rejects . toThrow ( 'The saveParsedSpecFile is not a boolean in options' ) ;
559+ } ) ;
560+ it ( '[domain::id] if the `domain::id` not provided in options, The generator throw an explicit error' , async ( ) => {
561+ await expect (
562+ plugin ( config , {
563+ domain : { name : 'domain_name' , version : '1.0.0' } ,
564+ services : [ { path : 'path/to/spec' , id : 'sevice_id' } ] ,
565+ } as any )
566+ ) . rejects . toThrow ( 'The domain id is required. please provide a domain id' ) ;
567+ } ) ;
568+ it ( '[domain::name] if the `domain::name` not provided in options, The generator throw an explicit error' , async ( ) => {
569+ await expect (
570+ plugin ( config , {
571+ domain : { id : 'domain_name' , version : '1.0.0' } ,
572+ services : [ { path : 'path/to/spec' , id : 'sevice_id' } ] ,
573+ } as any )
574+ ) . rejects . toThrow ( 'The domain name is required. please provide a domain name' ) ;
575+ } ) ;
576+ it ( '[domain::version] if the `domain::version` not provided in options, The generator throw an explicit error' , async ( ) => {
577+ await expect (
578+ plugin ( config , {
579+ domain : { id : 'domain_name' , name : 'domain_name' } ,
580+ services : [ { path : 'path/to/spec' , id : 'sevice_id' } ] ,
581+ } as any )
582+ ) . rejects . toThrow ( 'The domain version is required. please provide a domain version' ) ;
583+ } ) ;
513584 } ) ;
514585 } ) ;
515586 } ) ;
0 commit comments