@@ -379,6 +379,9 @@ describe('DBSQLClient.initAuthProvider', () => {
379379 it ( 'should use Databricks InHouse OAuth method (Azure)' , ( ) => {
380380 const client = new DBSQLClient ( ) ;
381381
382+ // When `useDatabricksOAuthInAzure = true`, it should use Databricks OAuth method
383+ // only for supported Azure hosts, and fail for others
384+
382385 case1: {
383386 const provider = client . initAuthProvider ( {
384387 authType : 'databricks-oauth' ,
@@ -392,15 +395,14 @@ describe('DBSQLClient.initAuthProvider', () => {
392395 }
393396
394397 case2: {
395- const provider = client . initAuthProvider ( {
396- authType : 'databricks-oauth' ,
397- // host is used when creating OAuth manager, so make it look like a real Azure instance
398- host : 'example.databricks.azure.us' ,
399- useDatabricksOAuthInAzure : true ,
400- } ) ;
401-
402- expect ( provider ) . to . be . instanceOf ( DatabricksOAuth ) ;
403- expect ( provider . manager ) . to . be . instanceOf ( AzureOAuthManager ) ;
398+ expect ( ( ) => {
399+ const provider = client . initAuthProvider ( {
400+ authType : 'databricks-oauth' ,
401+ // host is used when creating OAuth manager, so make it look like a real Azure instance
402+ host : 'example.databricks.azure.us' ,
403+ useDatabricksOAuthInAzure : true ,
404+ } ) ;
405+ } ) . to . throw ( ) ;
404406 }
405407 } ) ;
406408
0 commit comments