@@ -18,7 +18,10 @@ beforeAll(() => {
1818
1919afterEach ( async ( ) => {
2020 await clearDocuments ( services . shared , services . shared . workspace . LangiumDocuments . all . toArray ( ) )
21- fs . rmSync ( outDir , { recursive : true } )
21+ fs . rmSync ( outDir , {
22+ recursive : true ,
23+ force : true
24+ } )
2225} )
2326
2427describe ( 'Command execution tests' , ( ) => {
@@ -31,4 +34,34 @@ describe('Command execution tests', () => {
3134 const outContent = fs . readdirSync ( outDir )
3235 expect ( outContent ) . toHaveLength ( 1 )
3336 } )
37+
38+ test ( 'test plantUML command with invalid file extension' , async ( ) => {
39+ const file = path . join ( __dirname , '..' , 'invalid-files' , 'test.txt' )
40+
41+ const result = await commandHandler . executeCommand ( 'org.contextmapper.GeneratePlantUML' , [ file , outDir ] )
42+ expect ( result ) . toBeUndefined ( )
43+
44+ const outContentExists = fs . existsSync ( outDir )
45+ expect ( outContentExists ) . toEqual ( false )
46+ } )
47+
48+ test ( 'test plantUML command with invalid file' , async ( ) => {
49+ const file = path . join ( __dirname , '..' , 'invalid-files' , 'invalid.cml' )
50+
51+ const result = await commandHandler . executeCommand ( 'org.contextmapper.GeneratePlantUML' , [ file , outDir ] )
52+ expect ( result ) . toBeUndefined ( )
53+
54+ const outContentExists = fs . existsSync ( outDir )
55+ expect ( outContentExists ) . toEqual ( false )
56+ } )
57+
58+ test ( 'test plantUML command with non-existing file' , async ( ) => {
59+ const file = path . join ( __dirname , '..' , 'invalid-files' , 'non-existing.cml' )
60+
61+ const result = await commandHandler . executeCommand ( 'org.contextmapper.GeneratePlantUML' , [ file , outDir ] )
62+ expect ( result ) . toBeUndefined ( )
63+
64+ const outContentExists = fs . existsSync ( outDir )
65+ expect ( outContentExists ) . toEqual ( false )
66+ } )
3467} )
0 commit comments