@@ -15,8 +15,7 @@ import { splitNotifications } from '../../../streaming/__tests__/dataMocks';
1515import { RBSegmentsCacheInMemory } from '../../../../storages/inMemory/RBSegmentsCacheInMemory' ;
1616import { RB_SEGMENT_UPDATE , SPLIT_UPDATE } from '../../../streaming/constants' ;
1717import { IN_RULE_BASED_SEGMENT } from '../../../../utils/constants' ;
18- import { SDK_SPLITS_ARRIVED } from '../../../../readiness/constants' ;
19- import { SdkUpdateMetadataKeys } from '../../types' ;
18+ import { SDK_SPLITS_ARRIVED , FLAGS_UPDATE , SEGMENTS_UPDATE } from '../../../../readiness/constants' ;
2019
2120const ARCHIVED_FF = 'ARCHIVED' ;
2221
@@ -222,7 +221,7 @@ describe('splitChangesUpdater', () => {
222221 expect ( updateSplits ) . lastCalledWith ( splitChangesMock1 . ff . d , [ ] , splitChangesMock1 . ff . t ) ;
223222 expect ( updateRbSegments ) . toBeCalledTimes ( 0 ) ; // no rbSegments to update
224223 expect ( registerSegments ) . toBeCalledTimes ( 1 ) ;
225- expect ( splitsEmitSpy ) . toBeCalledWith ( SDK_SPLITS_ARRIVED , { type : SdkUpdateMetadataKeys . FLAGS_UPDATE , names : updatedFlags } ) ;
224+ expect ( splitsEmitSpy ) . toBeCalledWith ( SDK_SPLITS_ARRIVED , { type : FLAGS_UPDATE , names : updatedFlags } ) ;
226225 expect ( result ) . toBe ( true ) ;
227226 } ) ;
228227
@@ -288,7 +287,7 @@ describe('splitChangesUpdater', () => {
288287 for ( const setMock of setMocks ) {
289288 await expect ( splitChangesUpdater ( undefined , undefined , { payload : { ...payload , sets : setMock . sets , status : 'ACTIVE' } , changeNumber : index , type : SPLIT_UPDATE } ) ) . resolves . toBe ( true ) ;
290289 expect ( splitsEmitSpy . mock . calls [ index ] [ 0 ] ) . toBe ( SDK_SPLITS_ARRIVED ) ;
291- expect ( splitsEmitSpy . mock . calls [ index ] [ 1 ] ) . toEqual ( { type : SdkUpdateMetadataKeys . FLAGS_UPDATE , names : [ payload . name ] } ) ;
290+ expect ( splitsEmitSpy . mock . calls [ index ] [ 1 ] ) . toEqual ( { type : FLAGS_UPDATE , names : [ payload . name ] } ) ;
292291 index ++ ;
293292 }
294293
@@ -318,7 +317,7 @@ describe('splitChangesUpdater', () => {
318317
319318 await expect ( splitChangesUpdater ( undefined , undefined , { payload, changeNumber : changeNumber , type : SPLIT_UPDATE } ) ) . resolves . toBe ( true ) ;
320319
321- expect ( splitsEmitSpy ) . toBeCalledWith ( SDK_SPLITS_ARRIVED , { type : SdkUpdateMetadataKeys . FLAGS_UPDATE , names : [ payload . name ] } ) ;
320+ expect ( splitsEmitSpy ) . toBeCalledWith ( SDK_SPLITS_ARRIVED , { type : FLAGS_UPDATE , names : [ payload . name ] } ) ;
322321 } ) ;
323322
324323 test ( 'test with multiple flags updated - should emit metadata with all flag names' , async ( ) => {
@@ -337,7 +336,7 @@ describe('splitChangesUpdater', () => {
337336 await splitChangesUpdater ( ) ;
338337
339338 // Should emit with metadata when splitsArrived is false (first update)
340- expect ( splitsEmitSpy ) . toBeCalledWith ( SDK_SPLITS_ARRIVED , { type : SdkUpdateMetadataKeys . FLAGS_UPDATE , names : [ 'flag1' , 'flag2' , 'flag3' ] } ) ;
339+ expect ( splitsEmitSpy ) . toBeCalledWith ( SDK_SPLITS_ARRIVED , { type : FLAGS_UPDATE , names : [ 'flag1' , 'flag2' , 'flag3' ] } ) ;
341340 } ) ;
342341
343342 test ( 'test with ARCHIVED flag - should emit metadata with flag name' , async ( ) => {
@@ -356,7 +355,7 @@ describe('splitChangesUpdater', () => {
356355 await expect ( splitChangesUpdater ( undefined , undefined , { payload, changeNumber : changeNumber , type : SPLIT_UPDATE } ) ) . resolves . toBe ( true ) ;
357356
358357 // Should emit with metadata when splitsArrived is false (first update)
359- expect ( splitsEmitSpy ) . toBeCalledWith ( SDK_SPLITS_ARRIVED , { type : SdkUpdateMetadataKeys . FLAGS_UPDATE , names : [ payload . name ] } ) ;
358+ expect ( splitsEmitSpy ) . toBeCalledWith ( SDK_SPLITS_ARRIVED , { type : FLAGS_UPDATE , names : [ payload . name ] } ) ;
360359 } ) ;
361360
362361 test ( 'test with rbsegment payload - should emit SEGMENTS_UPDATE not FLAGS_UPDATE' , async ( ) => {
@@ -370,7 +369,7 @@ describe('splitChangesUpdater', () => {
370369 await expect ( splitChangesUpdater ( undefined , undefined , { payload, changeNumber : changeNumber , type : RB_SEGMENT_UPDATE } ) ) . resolves . toBe ( true ) ;
371370
372371 // Should emit SEGMENTS_UPDATE (not FLAGS_UPDATE) when only RB segment is updated
373- expect ( splitsEmitSpy ) . toBeCalledWith ( SDK_SPLITS_ARRIVED , { type : SdkUpdateMetadataKeys . SEGMENTS_UPDATE , names : [ ] } ) ;
372+ expect ( splitsEmitSpy ) . toBeCalledWith ( SDK_SPLITS_ARRIVED , { type : SEGMENTS_UPDATE , names : [ ] } ) ;
374373 } ) ;
375374
376375 test ( 'test with only RB segment update and no flags - should emit SEGMENTS_UPDATE' , async ( ) => {
@@ -385,7 +384,7 @@ describe('splitChangesUpdater', () => {
385384 await splitChangesUpdater ( ) ;
386385
387386 // When updatedFlags.length === 0, should emit SEGMENTS_UPDATE
388- expect ( splitsEmitSpy ) . toBeCalledWith ( SDK_SPLITS_ARRIVED , { type : SdkUpdateMetadataKeys . SEGMENTS_UPDATE , names : [ ] } ) ;
387+ expect ( splitsEmitSpy ) . toBeCalledWith ( SDK_SPLITS_ARRIVED , { type : SEGMENTS_UPDATE , names : [ ] } ) ;
389388 } ) ;
390389
391390 test ( 'test with both flags and RB segments updated - should emit FLAGS_UPDATE with flag names' , async ( ) => {
@@ -404,7 +403,7 @@ describe('splitChangesUpdater', () => {
404403 await splitChangesUpdater ( ) ;
405404
406405 // When both flags and RB segments are updated, should emit FLAGS_UPDATE with flag names
407- expect ( splitsEmitSpy ) . toBeCalledWith ( SDK_SPLITS_ARRIVED , { type : SdkUpdateMetadataKeys . FLAGS_UPDATE , names : [ 'flag1' , 'flag2' ] } ) ;
406+ expect ( splitsEmitSpy ) . toBeCalledWith ( SDK_SPLITS_ARRIVED , { type : FLAGS_UPDATE , names : [ 'flag1' , 'flag2' ] } ) ;
408407 } ) ;
409408
410409 test ( 'test client-side behavior - should emit even when segments not all fetched' , async ( ) => {
@@ -422,7 +421,7 @@ describe('splitChangesUpdater', () => {
422421 await clientSideUpdater ( ) ;
423422
424423 // Client-side should emit even if segments aren't all fetched (isClientSide bypasses checkAllSegmentsExist)
425- expect ( splitsEmitSpy ) . toBeCalledWith ( SDK_SPLITS_ARRIVED , { type : SdkUpdateMetadataKeys . FLAGS_UPDATE , names : [ 'client-flag' ] } ) ;
424+ expect ( splitsEmitSpy ) . toBeCalledWith ( SDK_SPLITS_ARRIVED , { type : FLAGS_UPDATE , names : [ 'client-flag' ] } ) ;
426425 } ) ;
427426
428427} ) ;
0 commit comments