@@ -24,6 +24,15 @@ function getTransactionExpiration(): string {
2424 return now . toISOString ( ) . slice ( 0 , 19 ) // Remove milliseconds and timezone
2525}
2626
27+ function getRandomName ( prefix : string ) : string {
28+ const chars = 'abcdefghijklmnopqrstuvwxyz12345'
29+ let result = prefix
30+ for ( let i = 0 ; i < 6 ; i ++ ) {
31+ result += chars . charAt ( Math . floor ( Math . random ( ) * chars . length ) )
32+ }
33+ return result
34+ }
35+
2736suite ( 'E2E Workflow' , ( ) => {
2837 const cliPath = path . join ( __dirname , '../../lib/cli.js' )
2938 let testDir : string
@@ -327,7 +336,7 @@ suite('E2E Workflow', () => {
327336
328337 suite ( 'Integration: Account and Deployment' , ( ) => {
329338 test ( 'can create an account on the local chain' , function ( ) {
330- const accountName = 'acc' + Math . random ( ) . toString ( 36 ) . substring ( 2 , 8 )
339+ const accountName = getRandomName ( 'acc' )
331340 const output = execSync ( `node ${ cliPath } wallet account create --name ${ accountName } ` , {
332341 encoding : 'utf8' ,
333342 } )
@@ -346,7 +355,7 @@ suite('E2E Workflow', () => {
346355 }
347356
348357 // 1. Create an account
349- const accountName = 'deploy' + Math . random ( ) . toString ( 36 ) . substring ( 2 , 8 )
358+ const accountName = getRandomName ( 'deploy' )
350359 execSync ( `node ${ cliPath } wallet account create --name ${ accountName } ` , {
351360 encoding : 'utf8' ,
352361 } )
@@ -388,7 +397,7 @@ suite('E2E Workflow', () => {
388397 this . skip ( )
389398 }
390399
391- const accountName = 'val' + Math . random ( ) . toString ( 36 ) . substring ( 2 , 8 )
400+ const accountName = getRandomName ( 'val' )
392401 execSync ( `node ${ cliPath } wallet account create --name ${ accountName } ` , {
393402 encoding : 'utf8' ,
394403 } )
0 commit comments