22// Licensed under the MIT License.
33
44import { describe , it , expect , vi , afterEach } from "vitest" ;
5- import { configureEntraIdAuth } from "@azure/postgresql-auth" ;
5+ import { configureEntraAuthentication } from "@azure/postgresql-auth" ;
66import {
77 createValidJwtToken ,
88 createJwtTokenWithAppId ,
@@ -17,14 +17,14 @@ afterEach(() => {
1717 vi . unstubAllEnvs ( ) ;
1818} ) ;
1919
20- describe ( "configureEntraIdAuth " , ( ) => {
20+ describe ( "configureEntraAuthentication " , ( ) => {
2121 describe ( "hook registration" , ( ) => {
2222 it ( "should register a beforeConnect callback on the sequelize instance" , ( ) => {
2323 const mock = createMockSequelizeInstance ( ) ;
2424 const token = createValidJwtToken ( TEST_USERS . ENTRA_USER ) ;
2525 const credential = new TestTokenCredential ( token ) ;
2626
27- configureEntraIdAuth ( mock , credential ) ;
27+ configureEntraAuthentication ( mock , credential ) ;
2828
2929 expect ( mock . capturedCallback ) . toBeDefined ( ) ;
3030 expect ( typeof mock . capturedCallback ) . toBe ( "function" ) ;
@@ -35,7 +35,7 @@ describe("configureEntraIdAuth", () => {
3535 const token = createValidJwtToken ( TEST_USERS . ENTRA_USER ) ;
3636 const credential = new TestTokenCredential ( token ) ;
3737
38- const result = configureEntraIdAuth ( mock , credential ) ;
38+ const result = configureEntraAuthentication ( mock , credential ) ;
3939
4040 expect ( result ) . toBe ( mock ) ;
4141 } ) ;
@@ -44,7 +44,7 @@ describe("configureEntraIdAuth", () => {
4444 const mock = createMockSequelizeInstance ( ) ;
4545
4646 // eslint-disable-next-line @typescript-eslint/no-explicit-any
47- expect ( ( ) => configureEntraIdAuth ( mock , null as any ) ) . toThrow ( "credential is required" ) ;
47+ expect ( ( ) => configureEntraAuthentication ( mock , null as any ) ) . toThrow ( "credential is required" ) ;
4848 } ) ;
4949 } ) ;
5050
@@ -54,7 +54,7 @@ describe("configureEntraIdAuth", () => {
5454 const token = createValidJwtToken ( TEST_USERS . ENTRA_USER ) ;
5555 const credential = new TestTokenCredential ( token ) ;
5656
57- configureEntraIdAuth ( mock , credential ) ;
57+ configureEntraAuthentication ( mock , credential ) ;
5858
5959 const config : { username ?: string ; password ?: string } = { } ;
6060 await mock . capturedCallback ! ( config ) ;
@@ -68,7 +68,7 @@ describe("configureEntraIdAuth", () => {
6868 const token = createValidJwtToken ( TEST_USERS . ENTRA_USER ) ;
6969 const credential = new TestTokenCredential ( token ) ;
7070
71- configureEntraIdAuth ( mock , credential ) ;
71+ configureEntraAuthentication ( mock , credential ) ;
7272
7373 const config = { username : "old-user" , password : "old-password" } ;
7474 await mock . capturedCallback ! ( config ) ;
@@ -86,7 +86,7 @@ describe("configureEntraIdAuth", () => {
8686 const token = createJwtTokenWithAppId ( TEST_USERS . MANAGED_IDENTITY_APP_ID ) ;
8787 const credential = new TestTokenCredential ( token ) ;
8888
89- configureEntraIdAuth ( mock , credential ) ;
89+ configureEntraAuthentication ( mock , credential ) ;
9090
9191 const config : { username ?: string ; password ?: string } = { } ;
9292 await mock . capturedCallback ! ( config ) ;
@@ -108,7 +108,7 @@ describe("configureEntraIdAuth", () => {
108108 const credential = new TestTokenCredential ( token ) ;
109109 const mock = createMockSequelizeInstance ( ) ;
110110
111- configureEntraIdAuth ( mock , credential , {
111+ configureEntraAuthentication ( mock , credential , {
112112 fallbackUsername : TEST_USERS . FALLBACK_USER ,
113113 } ) ;
114114
@@ -132,7 +132,7 @@ describe("configureEntraIdAuth", () => {
132132 const credential = new TestTokenCredential ( token ) ;
133133 const mock = createMockSequelizeInstance ( ) ;
134134
135- configureEntraIdAuth ( mock , credential ) ;
135+ configureEntraAuthentication ( mock , credential ) ;
136136
137137 const config : { username ?: string ; password ?: string } = { } ;
138138 await mock . capturedCallback ! ( config ) ;
@@ -153,7 +153,7 @@ describe("configureEntraIdAuth", () => {
153153 const credential = new TestTokenCredential ( token ) ;
154154 const mock = createMockSequelizeInstance ( ) ;
155155
156- configureEntraIdAuth ( mock , credential ) ;
156+ configureEntraAuthentication ( mock , credential ) ;
157157
158158 const config : { username ?: string ; password ?: string } = { } ;
159159 await expect ( mock . capturedCallback ! ( config ) ) . rejects . toThrow (
@@ -167,7 +167,7 @@ describe("configureEntraIdAuth", () => {
167167 const mock = createMockSequelizeInstance ( ) ;
168168 const credential = new FailingTokenCredential ( "Simulated auth failure" ) ;
169169
170- configureEntraIdAuth ( mock , credential ) ;
170+ configureEntraAuthentication ( mock , credential ) ;
171171
172172 const config : { username ?: string ; password ?: string } = { } ;
173173 await expect ( mock . capturedCallback ! ( config ) ) . rejects . toThrow ( "Simulated auth failure" ) ;
@@ -181,7 +181,7 @@ describe("configureEntraIdAuth", () => {
181181 const credential = new TestTokenCredential ( badToken ) ;
182182 const mock = createMockSequelizeInstance ( ) ;
183183
184- configureEntraIdAuth ( mock , credential ) ;
184+ configureEntraAuthentication ( mock , credential ) ;
185185
186186 const config : { username ?: string ; password ?: string } = { } ;
187187 // With no upn/appid/fallback, this should fail to determine a username
@@ -197,7 +197,7 @@ describe("configureEntraIdAuth", () => {
197197 const token = createValidJwtToken ( TEST_USERS . ENTRA_USER ) ;
198198 const credential = new TestTokenCredential ( token ) ;
199199
200- configureEntraIdAuth ( mock , credential ) ;
200+ configureEntraAuthentication ( mock , credential ) ;
201201
202202 const config1 : { username ?: string ; password ?: string } = { } ;
203203 await mock . capturedCallback ! ( config1 ) ;
0 commit comments