@@ -256,23 +256,19 @@ describe('OAuth Token API Routes', () => {
256256 describe ( 'service account path' , ( ) => {
257257 it ( 'threads the NetSuite SuiteTalk instance URL into the token response' , async ( ) => {
258258 const instanceUrl = 'https://1234567.suitetalk.api.netsuite.com'
259- const resolvedCredential = {
259+ authOAuthUtilsMockFns . mockResolveOAuthAccountId . mockResolvedValueOnce ( {
260260 accountId : '' ,
261261 credentialId : 'netsuite-credential-id' ,
262262 credentialType : 'service_account' ,
263263 providerId : 'netsuite-service-account' ,
264264 workspaceId : 'workspace-id' ,
265265 usedCredentialTable : true ,
266- } as const
267- authOAuthUtilsMockFns . mockResolveOAuthAccountId
268- . mockResolvedValueOnce ( resolvedCredential )
269- . mockResolvedValueOnce ( resolvedCredential )
266+ } )
270267 mockAuthorizeCredentialUse . mockResolvedValueOnce ( {
271268 ok : true ,
272269 authType : 'session' ,
273270 requesterUserId : 'test-user-id' ,
274271 workspaceId : 'workspace-id' ,
275- resolvedCredentialId : 'netsuite-credential-id' ,
276272 } )
277273 mockResolveServiceAccountToken . mockResolvedValueOnce ( {
278274 accessToken : 'netsuite-token' ,
@@ -289,23 +285,19 @@ describe('OAuth Token API Routes', () => {
289285 } )
290286
291287 it ( 'should thread authStyle from the resolver into the response' , async ( ) => {
292- const resolvedCredential = {
288+ authOAuthUtilsMockFns . mockResolveOAuthAccountId . mockResolvedValueOnce ( {
293289 accountId : '' ,
294290 credentialId : 'sa-credential-id' ,
295291 credentialType : 'service_account' ,
296292 providerId : 'pipedrive-service-account' ,
297293 workspaceId : 'workspace-id' ,
298294 usedCredentialTable : true ,
299- } as const
300- authOAuthUtilsMockFns . mockResolveOAuthAccountId
301- . mockResolvedValueOnce ( resolvedCredential )
302- . mockResolvedValueOnce ( resolvedCredential )
295+ } )
303296 mockAuthorizeCredentialUse . mockResolvedValueOnce ( {
304297 ok : true ,
305298 authType : 'session' ,
306299 requesterUserId : 'test-user-id' ,
307300 workspaceId : 'workspace-id' ,
308- resolvedCredentialId : 'sa-credential-id' ,
309301 } )
310302 mockResolveServiceAccountToken . mockResolvedValueOnce ( {
311303 accessToken : 'pasted-api-token' ,
@@ -323,23 +315,19 @@ describe('OAuth Token API Routes', () => {
323315 } )
324316
325317 it ( 'should omit authStyle for Bearer token-paste providers' , async ( ) => {
326- const resolvedCredential = {
318+ authOAuthUtilsMockFns . mockResolveOAuthAccountId . mockResolvedValueOnce ( {
327319 accountId : '' ,
328320 credentialId : 'sa-credential-id' ,
329321 credentialType : 'service_account' ,
330322 providerId : 'hubspot-service-account' ,
331323 workspaceId : 'workspace-id' ,
332324 usedCredentialTable : true ,
333- } as const
334- authOAuthUtilsMockFns . mockResolveOAuthAccountId
335- . mockResolvedValueOnce ( resolvedCredential )
336- . mockResolvedValueOnce ( resolvedCredential )
325+ } )
337326 mockAuthorizeCredentialUse . mockResolvedValueOnce ( {
338327 ok : true ,
339328 authType : 'session' ,
340329 requesterUserId : 'test-user-id' ,
341330 workspaceId : 'workspace-id' ,
342- resolvedCredentialId : 'sa-credential-id' ,
343331 } )
344332 mockResolveServiceAccountToken . mockResolvedValueOnce ( {
345333 accessToken : 'pat-token' ,
@@ -362,23 +350,19 @@ describe('OAuth Token API Routes', () => {
362350 ] as const ) (
363351 'surfaces the %s error code with status %i when the mint fails' ,
364352 async ( code , status ) => {
365- const resolvedCredential = {
353+ authOAuthUtilsMockFns . mockResolveOAuthAccountId . mockResolvedValueOnce ( {
366354 accountId : '' ,
367355 credentialId : 'sa-credential-id' ,
368356 credentialType : 'service_account' ,
369357 providerId : 'salesforce-service-account' ,
370358 workspaceId : 'workspace-id' ,
371359 usedCredentialTable : true ,
372- } as const
373- authOAuthUtilsMockFns . mockResolveOAuthAccountId
374- . mockResolvedValueOnce ( resolvedCredential )
375- . mockResolvedValueOnce ( resolvedCredential )
360+ } )
376361 mockAuthorizeCredentialUse . mockResolvedValueOnce ( {
377362 ok : true ,
378363 authType : 'session' ,
379364 requesterUserId : 'test-user-id' ,
380365 workspaceId : 'workspace-id' ,
381- resolvedCredentialId : 'sa-credential-id' ,
382366 } )
383367 mockResolveServiceAccountToken . mockRejectedValueOnce (
384368 new TokenServiceAccountValidationError ( code , status , { step : 'mint' } )
0 commit comments