@@ -55,6 +55,12 @@ describe('sandbox-lookup', () => {
5555 expect ( isFriendlySandboxId ( 'a1b2_c3d' ) ) . to . be . true ;
5656 } ) ;
5757
58+ it ( 'should return true for friendly IDs with f_ecom_ prefix' , ( ) => {
59+ expect ( isFriendlySandboxId ( 'f_ecom_zzpq_013' ) ) . to . be . true ;
60+ expect ( isFriendlySandboxId ( 'f_ecom_abcd_123' ) ) . to . be . true ;
61+ expect ( isFriendlySandboxId ( 'F_ECOM_ZZZV_456' ) ) . to . be . true ;
62+ } ) ;
63+
5864 it ( 'should return false for invalid friendly IDs' , ( ) => {
5965 expect ( isFriendlySandboxId ( 'abc-123' ) ) . to . be . false ; // realm too short
6066 expect ( isFriendlySandboxId ( 'abcde-123' ) ) . to . be . false ; // realm too long
@@ -82,6 +88,12 @@ describe('sandbox-lookup', () => {
8288 expect ( result ) . to . deep . equal ( { realm : 'abcd' , instance : 'xyz' } ) ;
8389 } ) ;
8490
91+ it ( 'should strip f_ecom_ prefix and parse' , ( ) => {
92+ expect ( parseFriendlySandboxId ( 'f_ecom_zzpq_013' ) ) . to . deep . equal ( { realm : 'zzpq' , instance : '013' } ) ;
93+ expect ( parseFriendlySandboxId ( 'f_ecom_abcd_123' ) ) . to . deep . equal ( { realm : 'abcd' , instance : '123' } ) ;
94+ expect ( parseFriendlySandboxId ( 'F_ECOM_ZZZV_456' ) ) . to . deep . equal ( { realm : 'zzzv' , instance : '456' } ) ;
95+ } ) ;
96+
8597 it ( 'should return null for invalid formats' , ( ) => {
8698 expect ( parseFriendlySandboxId ( 'abc-123' ) ) . to . be . null ;
8799 expect ( parseFriendlySandboxId ( 'abcde-123' ) ) . to . be . null ;
@@ -173,6 +185,23 @@ describe('sandbox-lookup', () => {
173185 expect ( result ) . to . equal ( expectedUuid ) ;
174186 } ) ;
175187
188+ it ( 'should look up sandbox by friendly ID with f_ecom_ prefix' , async ( ) => {
189+ const expectedUuid = 'found-uuid-1234-1234-abc123456789' ;
190+
191+ server . use (
192+ http . get ( `${ BASE_URL } /sandboxes` , ( { request} ) => {
193+ const url = new URL ( request . url ) ;
194+ expect ( url . searchParams . get ( 'filter_params' ) ) . to . equal ( 'realm=zzpq' ) ;
195+ return HttpResponse . json ( {
196+ data : [ { id : expectedUuid , realm : 'zzpq' , instance : '013' , state : 'started' } ] ,
197+ } ) ;
198+ } ) ,
199+ ) ;
200+
201+ const result = await resolveSandboxId ( odsClient , 'f_ecom_zzpq_013' ) ;
202+ expect ( result ) . to . equal ( expectedUuid ) ;
203+ } ) ;
204+
176205 it ( 'should throw SandboxNotFoundError when sandbox not found' , async ( ) => {
177206 server . use (
178207 http . get ( `${ BASE_URL } /sandboxes` , ( ) => {
0 commit comments