@@ -25,7 +25,7 @@ describe('databases-ui', () => {
2525
2626 it ( 'should choose parent direcory when db-* is selected' , async ( ) => {
2727 const dir = tmp . dirSync ( ) . name ;
28- const dbDir = path . join ( dir , 'db-hucairz ' ) ;
28+ const dbDir = path . join ( dir , 'db-javascript ' ) ;
2929 await fs . mkdirs ( dbDir ) ;
3030
3131 const uri = await fixDbUri ( Uri . file ( dbDir ) ) ;
@@ -34,14 +34,26 @@ describe('databases-ui', () => {
3434
3535 it ( 'should choose parent\'s parent direcory when file selected is in db-*' , async ( ) => {
3636 const dir = tmp . dirSync ( ) . name ;
37- const dbDir = path . join ( dir , 'db-hucairz ' ) ;
37+ const dbDir = path . join ( dir , 'db-javascript ' ) ;
3838 const file = path . join ( dbDir , 'nested' ) ;
3939 await fs . mkdirs ( dbDir ) ;
4040 await fs . createFile ( file ) ;
4141
4242 const uri = await fixDbUri ( Uri . file ( file ) ) ;
4343 expect ( uri . toString ( ) ) . to . eq ( Uri . file ( dir ) . toString ( ) ) ;
4444 } ) ;
45- } ) ;
4645
46+ it ( 'should handle a parent whose name is db-*' , async ( ) => {
47+ // fixes https://github.com/github/vscode-codeql/issues/482
48+ const dir = tmp . dirSync ( ) . name ;
49+ const parentDir = path . join ( dir , 'db-hucairz' ) ;
50+ const dbDir = path . join ( parentDir , 'db-javascript' ) ;
51+ const file = path . join ( dbDir , 'nested' ) ;
52+ await fs . mkdirs ( dbDir ) ;
53+ await fs . createFile ( file ) ;
54+
55+ const uri = await fixDbUri ( Uri . file ( file ) ) ;
56+ expect ( uri . toString ( ) ) . to . eq ( Uri . file ( parentDir ) . toString ( ) ) ;
57+ } ) ;
58+ } ) ;
4759} ) ;
0 commit comments