@@ -34,7 +34,7 @@ test('exports', () => {
3434} )
3535
3636describe ( 'importConsoleConfig' , ( ) => {
37- test ( 'with oauth_server_to_server credentials, adds IMS_OAUTH_S2S to env vars' , async ( ) => {
37+ test ( 'with oauth_server_to_server credentials, unpacks IMS_OAUTH_S2S_* env vars' , async ( ) => {
3838 const configContent = fixtureFile ( 'oauths2s/valid.config.json' )
3939 // The file is read twice: once by importConsoleConfig (loadFunc) and once by importConfigJson
4040 fs . readFileSync . mockReturnValue ( configContent )
@@ -44,17 +44,17 @@ describe('importConsoleConfig', () => {
4444 expect ( config ) . toBeDefined ( )
4545 expect ( config . project . name ) . toEqual ( 'TestProject123' )
4646
47- // Check that writeFile was called with the IMS_OAUTH_S2S_ENV variable
4847 const envWriteCall = fs . writeFile . mock . calls . find ( call => call [ 0 ] . endsWith ( '.env' ) )
4948 expect ( envWriteCall ) . toBeDefined ( )
50- expect ( envWriteCall [ 1 ] ) . toContain ( SERVICE_API_KEY_ENV )
51- expect ( envWriteCall [ 1 ] ) . toContain ( IMS_OAUTH_S2S_ENV )
52-
53- // Verify the IMS_OAUTH_S2S value contains expected credential data
5449 const envContent = envWriteCall [ 1 ]
55- expect ( envContent ) . toContain ( '"client_id":"CXCXCXCXCXCXCXCXC"' )
56- expect ( envContent ) . toContain ( '"client_secret":"SFSFSFSFSFSFSFSFSFSFSFSFSFS"' )
57- expect ( envContent ) . toContain ( '"org_id":"XOXOXOXOXOXOX@AdobeOrg"' )
50+ expect ( envContent ) . toContain ( SERVICE_API_KEY_ENV )
51+ expect ( envContent ) . toContain ( IMS_OAUTH_S2S_ENV )
52+
53+ // Credential is unpacked into IMS_OAUTH_S2S_* vars
54+ expect ( envContent ) . toContain ( 'IMS_OAUTH_S2S_CLIENT_ID=CXCXCXCXCXCXCXCXC' )
55+ expect ( envContent ) . toContain ( 'IMS_OAUTH_S2S_CLIENT_SECRET=SFSFSFSFSFSFSFSFSFSFSFSFSFS' )
56+ expect ( envContent ) . toContain ( 'IMS_OAUTH_S2S_ORG_ID=XOXOXOXOXOXOX@AdobeOrg' )
57+ expect ( envContent ) . toContain ( 'IMS_OAUTH_S2S_SCOPES=["openid","AdobeID"]' ) // stringified array
5858 } )
5959
6060 test ( 'with jwt credentials only, does not add IMS_OAUTH_S2S to env vars' , async ( ) => {
0 commit comments