@@ -81,10 +81,12 @@ describe('asyncapi export: presets and annotations', () => {
81
81
expect ( ( ) => toAsyncAPI ( csn ) ) . toThrowError ( "There are no service definitions found in the given model(s)." ) ;
82
82
} ) ;
83
83
84
- test ( 'Negative test for version' , async ( ) => {
84
+ test ( 'Check for default title and version if not provided in the input ' , async ( ) => {
85
85
const inputCDS = await read ( join ( baseInputPath , 'invalid' , 'noTitle.cds' ) ) ;
86
86
const csn = cds . compile . to . csn ( inputCDS ) ;
87
- expect ( ( ) => toAsyncAPI ( csn ) ) . toThrowError ( "Title and Version info annotations needs to be added to the service(s)." ) ;
87
+ const generatedAsyncAPI = toAsyncAPI ( csn ) ;
88
+ expect ( generatedAsyncAPI ) . toHaveProperty ( 'info.title' , `Use @title: '...' on your CDS service to provide a meaningful title.` ) ;
89
+ expect ( generatedAsyncAPI ) . toHaveProperty ( 'info.version' , '1.0.0' ) ;
88
90
} ) ;
89
91
90
92
test ( 'Test for application namespace' , async ( ) => {
@@ -94,4 +96,12 @@ describe('asyncapi export: presets and annotations', () => {
94
96
const generatedAsyncAPI = toAsyncAPI ( csn ) ;
95
97
expect ( generatedAsyncAPI ) . toHaveProperty ( 'x-sap-application-namespace' , 'customer.cap-js-asyncapi' )
96
98
} ) ;
99
+ test ( 'Console warnings and errors are not used' , async ( ) => {
100
+ const inputCDS = await read ( join ( baseInputPath , 'valid' , 'presets.cds' ) ) ;
101
+ const csn = cds . compile . to . csn ( inputCDS ) ;
102
+ const generatedAsyncAPI = toAsyncAPI ( csn ) ;
103
+
104
+ expect ( generatedAsyncAPI ) . not . toHaveProperty ( 'console.warn' ) ;
105
+ expect ( generatedAsyncAPI ) . not . toHaveProperty ( 'console.error' ) ;
106
+ } ) ;
97
107
} ) ;
0 commit comments