@@ -328,23 +328,19 @@ describe('OAuth Token API Routes', () => {
328328 describe ( 'service account path' , ( ) => {
329329 it ( 'threads the NetSuite SuiteTalk instance URL into the token response' , async ( ) => {
330330 const instanceUrl = 'https://1234567.suitetalk.api.netsuite.com'
331- const resolvedCredential = {
331+ authOAuthUtilsMockFns . mockResolveOAuthAccountId . mockResolvedValueOnce ( {
332332 accountId : '' ,
333333 credentialId : 'netsuite-credential-id' ,
334334 credentialType : 'service_account' ,
335335 providerId : 'netsuite-service-account' ,
336336 workspaceId : 'workspace-id' ,
337337 usedCredentialTable : true ,
338- } as const
339- authOAuthUtilsMockFns . mockResolveOAuthAccountId
340- . mockResolvedValueOnce ( resolvedCredential )
341- . mockResolvedValueOnce ( resolvedCredential )
338+ } )
342339 mockAuthorizeCredentialUse . mockResolvedValueOnce ( {
343340 ok : true ,
344341 authType : 'session' ,
345342 requesterUserId : 'test-user-id' ,
346343 workspaceId : 'workspace-id' ,
347- resolvedCredentialId : 'netsuite-credential-id' ,
348344 } )
349345 mockResolveServiceAccountToken . mockResolvedValueOnce ( {
350346 accessToken : 'netsuite-token' ,
@@ -361,23 +357,19 @@ describe('OAuth Token API Routes', () => {
361357 } )
362358
363359 it ( 'should thread authStyle from the resolver into the response' , async ( ) => {
364- const resolvedCredential = {
360+ authOAuthUtilsMockFns . mockResolveOAuthAccountId . mockResolvedValueOnce ( {
365361 accountId : '' ,
366362 credentialId : 'sa-credential-id' ,
367363 credentialType : 'service_account' ,
368364 providerId : 'pipedrive-service-account' ,
369365 workspaceId : 'workspace-id' ,
370366 usedCredentialTable : true ,
371- } as const
372- authOAuthUtilsMockFns . mockResolveOAuthAccountId
373- . mockResolvedValueOnce ( resolvedCredential )
374- . mockResolvedValueOnce ( resolvedCredential )
367+ } )
375368 mockAuthorizeCredentialUse . mockResolvedValueOnce ( {
376369 ok : true ,
377370 authType : 'session' ,
378371 requesterUserId : 'test-user-id' ,
379372 workspaceId : 'workspace-id' ,
380- resolvedCredentialId : 'sa-credential-id' ,
381373 } )
382374 mockResolveServiceAccountToken . mockResolvedValueOnce ( {
383375 accessToken : 'pasted-api-token' ,
@@ -395,23 +387,19 @@ describe('OAuth Token API Routes', () => {
395387 } )
396388
397389 it ( 'should omit authStyle for Bearer token-paste providers' , async ( ) => {
398- const resolvedCredential = {
390+ authOAuthUtilsMockFns . mockResolveOAuthAccountId . mockResolvedValueOnce ( {
399391 accountId : '' ,
400392 credentialId : 'sa-credential-id' ,
401393 credentialType : 'service_account' ,
402394 providerId : 'hubspot-service-account' ,
403395 workspaceId : 'workspace-id' ,
404396 usedCredentialTable : true ,
405- } as const
406- authOAuthUtilsMockFns . mockResolveOAuthAccountId
407- . mockResolvedValueOnce ( resolvedCredential )
408- . mockResolvedValueOnce ( resolvedCredential )
397+ } )
409398 mockAuthorizeCredentialUse . mockResolvedValueOnce ( {
410399 ok : true ,
411400 authType : 'session' ,
412401 requesterUserId : 'test-user-id' ,
413402 workspaceId : 'workspace-id' ,
414- resolvedCredentialId : 'sa-credential-id' ,
415403 } )
416404 mockResolveServiceAccountToken . mockResolvedValueOnce ( {
417405 accessToken : 'pat-token' ,
@@ -434,23 +422,19 @@ describe('OAuth Token API Routes', () => {
434422 ] as const ) (
435423 'surfaces the %s error code with status %i when the mint fails' ,
436424 async ( code , status ) => {
437- const resolvedCredential = {
425+ authOAuthUtilsMockFns . mockResolveOAuthAccountId . mockResolvedValueOnce ( {
438426 accountId : '' ,
439427 credentialId : 'sa-credential-id' ,
440428 credentialType : 'service_account' ,
441429 providerId : 'salesforce-service-account' ,
442430 workspaceId : 'workspace-id' ,
443431 usedCredentialTable : true ,
444- } as const
445- authOAuthUtilsMockFns . mockResolveOAuthAccountId
446- . mockResolvedValueOnce ( resolvedCredential )
447- . mockResolvedValueOnce ( resolvedCredential )
432+ } )
448433 mockAuthorizeCredentialUse . mockResolvedValueOnce ( {
449434 ok : true ,
450435 authType : 'session' ,
451436 requesterUserId : 'test-user-id' ,
452437 workspaceId : 'workspace-id' ,
453- resolvedCredentialId : 'sa-credential-id' ,
454438 } )
455439 mockResolveServiceAccountToken . mockRejectedValueOnce (
456440 new TokenServiceAccountValidationError ( code , status , { step : 'mint' } )
0 commit comments