@@ -506,7 +506,7 @@ describe('stringCodec', () => {
506506 } ) ;
507507} ) ;
508508
509- describe ( 'getShardId ' , ( ) => {
509+ describe ( 'getUniqueInstanceId ' , ( ) => {
510510 it ( 'should generate shard ID with readable timestamp' , ( ) => {
511511 const counter = { next : ( ) => 1 } ;
512512 const result = getUniqueInstanceId ( counter ) ;
@@ -527,25 +527,30 @@ describe('getShardId', () => {
527527 } ) ;
528528
529529 it ( 'should handle zero values' , ( ) => {
530- const result = getShardId ( ) ;
530+ const counter = { next : ( ) => 1 } ;
531+ const result = getUniqueInstanceId ( counter ) ;
531532 expect ( result ) . toStartWith ( '20231114-221320-000.' ) ;
532533 } ) ;
533534
534535 it ( 'should handle negative timestamps' , ( ) => {
535- const result = getShardId ( ) ;
536+ const counter = { next : ( ) => 1 } ;
537+ const result = getUniqueInstanceId ( counter ) ;
536538
537539 expect ( result ) . toStartWith ( '20231114-221320-000.' ) ;
538540 } ) ;
539541
540542 it ( 'should handle large timestamps' , ( ) => {
541- const result = getShardId ( ) ;
543+ const counter = { next : ( ) => 1 } ;
544+ const result = getUniqueInstanceId ( counter ) ;
542545
543546 expect ( result ) . toStartWith ( '20231114-221320-000.' ) ;
544547 } ) ;
545548
546549 it ( 'should generate incrementing counter' , ( ) => {
547- const result1 = getShardId ( ) ;
548- const result2 = getShardId ( ) ;
550+ let count = 0 ;
551+ const counter = { next : ( ) => ++ count } ;
552+ const result1 = getUniqueInstanceId ( counter ) ;
553+ const result2 = getUniqueInstanceId ( counter ) ;
549554
550555 const parts1 = result1 . split ( '.' ) ;
551556 const parts2 = result2 . split ( '.' ) ;
@@ -558,7 +563,7 @@ describe('getShardId', () => {
558563 } ) ;
559564} ) ;
560565
561- describe ( 'getShardedGroupId ' , ( ) => {
566+ describe ( 'getUniqueTimeId ' , ( ) => {
562567 it ( 'should work with mocked timeOrigin' , ( ) => {
563568 const result = getUniqueTimeId ( ) ;
564569
@@ -824,7 +829,7 @@ describe('ShardedWal', () => {
824829 } ,
825830 coordinatorIdEnvVar : SHARDED_WAL_COORDINATOR_ID_ENV_VAR ,
826831 } ) ;
827- // Create the group directory (matches actual getShardedGroupId () output)
832+ // Create the group directory (matches actual getUniqueTimeId () output)
828833 vol . mkdirSync ( '/empty/20231114-221320-000' , { recursive : true } ) ;
829834 const files = ( sw as any ) . shardFiles ( ) ;
830835 expect ( files ) . toEqual ( [ ] ) ;
0 commit comments