@@ -31,17 +31,17 @@ describe('SplitTreatments', () => {
3131 afterEach ( ( ) => { logSpy . mockClear ( ) } ) ;
3232
3333 it ( 'passes as treatments prop the value returned by the function "getControlTreatmentsWithConfig" if the SDK is not ready.' , ( done ) => {
34- const splitNames = [ 'split1' , 'split2' ] ;
34+ const featureFlagNames = [ 'split1' , 'split2' ] ;
3535 render (
3636 < SplitFactory config = { sdkBrowser } > {
3737 ( { factory } ) => {
3838 return (
3939 < SplitClient splitKey = 'user1' >
40- < SplitTreatments names = { splitNames } >
40+ < SplitTreatments names = { featureFlagNames } >
4141 { ( { treatments } : ISplitTreatmentsChildProps ) => {
4242 const clientMock : any = factory ?. client ( 'user1' ) ;
4343 expect ( clientMock . getTreatmentsWithConfig . mock . calls . length ) . toBe ( 0 ) ;
44- expect ( treatments ) . toEqual ( getControlTreatmentsWithConfig ( splitNames ) ) ;
44+ expect ( treatments ) . toEqual ( getControlTreatmentsWithConfig ( featureFlagNames ) ) ;
4545 done ( ) ;
4646 return null ;
4747 } }
@@ -53,7 +53,7 @@ describe('SplitTreatments', () => {
5353 } ) ;
5454
5555 it ( 'passes as treatments prop the value returned by the method "client.getTreatmentsWithConfig" if the SDK is ready.' , ( done ) => {
56- const splitNames = [ 'split1' , 'split2' ] ;
56+ const featureFlagNames = [ 'split1' , 'split2' ] ;
5757 const outerFactory = SplitSdk ( sdkBrowser ) ;
5858 ( outerFactory as any ) . client ( ) . __emitter__ . emit ( Event . SDK_READY ) ;
5959
@@ -63,12 +63,12 @@ describe('SplitTreatments', () => {
6363 expect ( getStatus ( outerFactory . client ( ) ) . isReady ) . toBe ( isReady ) ;
6464 expect ( isReady ) . toBe ( true ) ;
6565 return (
66- < SplitTreatments names = { splitNames } >
66+ < SplitTreatments names = { featureFlagNames } >
6767 { ( { treatments, isReady : isReady2 , isReadyFromCache, hasTimedout, isTimedout, isDestroyed, lastUpdate } : ISplitTreatmentsChildProps ) => {
6868 const clientMock : any = factory ?. client ( ) ;
6969 expect ( clientMock . getTreatmentsWithConfig . mock . calls . length ) . toBe ( 1 ) ;
7070 expect ( treatments ) . toBe ( clientMock . getTreatmentsWithConfig . mock . results [ 0 ] . value ) ;
71- expect ( splitNames ) . toBe ( clientMock . getTreatmentsWithConfig . mock . calls [ 0 ] [ 0 ] ) ;
71+ expect ( featureFlagNames ) . toBe ( clientMock . getTreatmentsWithConfig . mock . calls [ 0 ] [ 0 ] ) ;
7272 expect ( [ isReady2 , isReadyFromCache , hasTimedout , isTimedout , isDestroyed , lastUpdate ] ) . toStrictEqual ( [ true , false , false , false , false , 0 ] ) ;
7373 done ( ) ;
7474 return null ;
@@ -80,17 +80,17 @@ describe('SplitTreatments', () => {
8080 } ) ;
8181
8282 it ( 'logs error and passes control treatments ("getControlTreatmentsWithConfig") if rendered outside an SplitProvider component.' , ( ) => {
83- const splitNames = [ 'split1' , 'split2' ] ;
83+ const featureFlagNames = [ 'split1' , 'split2' ] ;
8484 let passedTreatments ;
8585 render (
86- < SplitTreatments names = { splitNames } >
86+ < SplitTreatments names = { featureFlagNames } >
8787 { ( { treatments } : ISplitTreatmentsChildProps ) => {
8888 passedTreatments = treatments ;
8989 return null ;
9090 } }
9191 </ SplitTreatments > ) ;
9292 expect ( logSpy ) . toBeCalledWith ( WARN_ST_NO_CLIENT ) ;
93- expect ( getControlTreatmentsWithConfig ) . toBeCalledWith ( splitNames ) ;
93+ expect ( getControlTreatmentsWithConfig ) . toBeCalledWith ( featureFlagNames ) ;
9494 expect ( getControlTreatmentsWithConfig ) . toHaveReturnedWith ( passedTreatments ) ;
9595 } ) ;
9696
@@ -99,22 +99,22 @@ describe('SplitTreatments', () => {
9999 * is not ready doesn't emit errors, and logs meaningful messages instead.
100100 */
101101 it ( 'Input validation: invalid "names" and "attributes" props in SplitTreatments.' , ( done ) => {
102- const splitNames = [ 'split1' , 'split2' ] ;
102+ const featureFlagNames = [ 'split1' , 'split2' ] ;
103103
104104 render (
105105 < SplitFactory config = { sdkBrowser } > {
106106 ( ) => {
107107 return (
108108 < >
109109 { /* @ts -expect-error Test error handling */ }
110- < SplitTreatments split_names = { splitNames } >
110+ < SplitTreatments split_names = { featureFlagNames } >
111111 { ( { treatments } : ISplitTreatmentsChildProps ) => {
112112 expect ( treatments ) . toEqual ( { } ) ;
113113 return null ;
114114 } }
115115 </ SplitTreatments >
116116 { /* @ts -expect-error Test error handling */ }
117- < SplitTreatments names = { splitNames [ 0 ] } >
117+ < SplitTreatments names = { featureFlagNames [ 0 ] } >
118118 { ( { treatments } : ISplitTreatmentsChildProps ) => {
119119 expect ( treatments ) . toEqual ( { } ) ;
120120 return null ;
@@ -186,28 +186,28 @@ describe('SplitTreatments optimization', () => {
186186 wrapper . unmount ( ) ; // unmount to remove event listener from factory
187187 } )
188188
189- it ( 'rerenders but does not re-evaluate splits if client, lastUpdate, names and attributes are the same object.' , ( ) => {
189+ it ( 'rerenders but does not re-evaluate feature flags if client, lastUpdate, names and attributes are the same object.' , ( ) => {
190190 wrapper . rerender ( < Component names = { names } attributes = { attributes } splitKey = { splitKey } /> ) ;
191191
192192 expect ( renderTimes ) . toBe ( 2 ) ;
193193 expect ( outerFactory . client ( ) . getTreatmentsWithConfig ) . toBeCalledTimes ( 1 ) ;
194194 } ) ;
195195
196- it ( 'rerenders but does not re-evaluate splits if client, lastUpdate, names and attributes are equals (shallow comparison).' , ( ) => {
196+ it ( 'rerenders but does not re-evaluate feature flags if client, lastUpdate, names and attributes are equals (shallow comparison).' , ( ) => {
197197 wrapper . rerender ( < Component names = { [ ...names ] } attributes = { { ...attributes } } splitKey = { splitKey } /> ) ;
198198
199199 expect ( renderTimes ) . toBe ( 2 ) ;
200200 expect ( outerFactory . client ( ) . getTreatmentsWithConfig ) . toBeCalledTimes ( 1 ) ;
201201 } ) ;
202202
203- it ( 'rerenders and re-evaluates splits if names are not equals (shallow array comparison).' , ( ) => {
203+ it ( 'rerenders and re-evaluates feature flags if names are not equals (shallow array comparison).' , ( ) => {
204204 wrapper . rerender ( < Component names = { [ ...names , 'split3' ] } attributes = { { ...attributes } } splitKey = { splitKey } /> ) ;
205205
206206 expect ( renderTimes ) . toBe ( 2 ) ;
207207 expect ( outerFactory . client ( ) . getTreatmentsWithConfig ) . toBeCalledTimes ( 2 ) ;
208208 } ) ;
209209
210- it ( 'rerenders and re-evaluates splits if attributes are not equals (shallow object comparison).' , ( ) => {
210+ it ( 'rerenders and re-evaluates feature flags if attributes are not equals (shallow object comparison).' , ( ) => {
211211 const attributesRef = { ...attributes , att2 : 'att2' } ;
212212 wrapper . rerender ( < Component names = { [ ...names ] } attributes = { attributesRef } splitKey = { splitKey } /> ) ;
213213
@@ -221,7 +221,7 @@ describe('SplitTreatments optimization', () => {
221221 expect ( outerFactory . client ( ) . getTreatmentsWithConfig ) . toBeCalledTimes ( 2 ) ;
222222 } ) ;
223223
224- it ( 'rerenders and re-evaluates splits if lastUpdate timestamp changes (e.g., SDK_UPDATE event).' , ( done ) => {
224+ it ( 'rerenders and re-evaluates feature flags if lastUpdate timestamp changes (e.g., SDK_UPDATE event).' , ( done ) => {
225225 expect ( renderTimes ) . toBe ( 1 ) ;
226226
227227 // State update and split evaluation
@@ -243,7 +243,7 @@ describe('SplitTreatments optimization', () => {
243243 } )
244244 } ) ;
245245
246- it ( 'rerenders and re-evaluates splits if client changes.' , ( ) => {
246+ it ( 'rerenders and re-evaluates feature flags if client changes.' , ( ) => {
247247 wrapper . rerender ( < Component names = { names } attributes = { attributes } splitKey = { 'otherKey' } /> ) ;
248248 act ( ( ) => ( outerFactory as any ) . client ( 'otherKey' ) . __emitter__ . emit ( Event . SDK_READY ) ) ;
249249
@@ -253,7 +253,7 @@ describe('SplitTreatments optimization', () => {
253253 expect ( outerFactory . client ( 'otherKey' ) . getTreatmentsWithConfig ) . toBeCalledTimes ( 1 ) ;
254254 } ) ;
255255
256- it ( 'rerenders and re-evaluate splits when Split context changes (in both SplitFactory and SplitClient components).' , async ( ) => {
256+ it ( 'rerenders and re-evaluate splfeature flagsits when Split context changes (in both SplitFactory and SplitClient components).' , async ( ) => {
257257 // changes in SplitContext implies that either the factory, the client (user key), or its status changed, what might imply a change in treatments
258258 const outerFactory = SplitSdk ( sdkBrowser ) ;
259259 const names = [ 'split1' , 'split2' ] ;
@@ -327,7 +327,7 @@ describe('SplitTreatments optimization', () => {
327327 expect ( outerFactory . client ( 'user2' ) . getTreatmentsWithConfig ) . toBeCalledTimes ( 4 ) ; // idem
328328 } ) ;
329329
330- it ( 'rerenders and re-evaluates splits if client attributes changes.' , ( done ) => {
330+ it ( 'rerenders and re-evaluates feature flags if client attributes changes.' , ( done ) => {
331331 const originalFactory = outerFactory ;
332332 outerFactory = newSplitFactoryLocalhostInstance ( ) ;
333333
0 commit comments