@@ -999,3 +999,47 @@ describe('DROP statement', () => {
999999 expect ( result . candidates [ 0 ] . label ) . toEqual ( 'TABLE1' )
10001000 } )
10011001} )
1002+
1003+ const SIMPLE_NESTED_SCHEMA_WITH_HYPHEN = {
1004+ tables : [
1005+ {
1006+ catalog : 'catalog-3' ,
1007+ database : 'schema3' ,
1008+ tableName : 'table3' ,
1009+ columns : [ { columnName : 'abc' , description : 'def' } ] ,
1010+ } ,
1011+ ] ,
1012+ functions : [ ] ,
1013+ }
1014+
1015+ describe ( 'Fully qualified table names with dash' , ( ) => {
1016+ test ( 'complete catalog name' , ( ) => {
1017+ const result = complete (
1018+ 'SELECT * FROM catalog-3.sch' ,
1019+ { line : 0 , column : 26 } ,
1020+ SIMPLE_NESTED_SCHEMA_WITH_HYPHEN
1021+ )
1022+ expect ( result . candidates . length ) . toEqual ( 1 )
1023+ const expected = [ expect . objectContaining ( { label : 'schema3' } ) ]
1024+ expect ( result . candidates ) . toEqual ( expect . arrayContaining ( expected ) )
1025+ } )
1026+ test ( 'complete table name' , ( ) => {
1027+ const result = complete (
1028+ 'SELECT * FROM catalog-3.schema3.tab' ,
1029+ { line : 0 , column : 34 } ,
1030+ SIMPLE_NESTED_SCHEMA_WITH_HYPHEN
1031+ )
1032+ expect ( result . candidates . length ) . toEqual ( 1 )
1033+ const expected = [ expect . objectContaining ( { label : 'table3' } ) ]
1034+ expect ( result . candidates ) . toEqual ( expect . arrayContaining ( expected ) )
1035+ } )
1036+ test ( 'complete table name on dot' , ( ) => {
1037+ const result = complete (
1038+ 'SELECT * FROM catalog-3.schema3.' ,
1039+ { line : 0 , column : 32 } ,
1040+ SIMPLE_NESTED_SCHEMA_WITH_HYPHEN
1041+ )
1042+ const expected = [ expect . objectContaining ( { label : 'table3' } ) ]
1043+ expect ( result . candidates ) . toEqual ( expect . arrayContaining ( expected ) )
1044+ } )
1045+ } )
0 commit comments