@@ -56,12 +56,12 @@ describe('useSplitClient', () => {
56
56
< SplitFactoryProvider factory = { outerFactory } >
57
57
{ React . createElement ( ( ) => {
58
58
( outerFactory . client as jest . Mock ) . mockClear ( ) ;
59
- client = useSplitClient ( { splitKey : 'user2' , trafficType : 'user' } ) . client ;
59
+ client = useSplitClient ( { splitKey : 'user2' } ) . client ;
60
60
return null ;
61
61
} ) }
62
62
</ SplitFactoryProvider >
63
63
) ;
64
- expect ( outerFactory . client as jest . Mock ) . toBeCalledWith ( 'user2' , 'user' ) ;
64
+ expect ( outerFactory . client as jest . Mock ) . toBeCalledWith ( 'user2' ) ;
65
65
expect ( outerFactory . client as jest . Mock ) . toHaveReturnedWith ( client ) ;
66
66
} ) ;
67
67
@@ -70,7 +70,7 @@ describe('useSplitClient', () => {
70
70
render (
71
71
React . createElement ( ( ) => {
72
72
useSplitClient ( ) ;
73
- useSplitClient ( { splitKey : 'user2' , trafficType : 'user' } ) ;
73
+ useSplitClient ( { splitKey : 'user2' } ) ;
74
74
return null ;
75
75
} )
76
76
) ;
@@ -81,7 +81,7 @@ describe('useSplitClient', () => {
81
81
82
82
// eslint-disable-next-line react/prop-types
83
83
const InnerComponent = ( { splitKey, attributesClient, testSwitch } ) => {
84
- useSplitClient ( { splitKey, trafficType : 'user' , attributes : attributesClient } ) ;
84
+ useSplitClient ( { splitKey, attributes : attributesClient } ) ;
85
85
testSwitch ( done , splitKey ) ;
86
86
return null ;
87
87
} ;
@@ -112,16 +112,16 @@ describe('useSplitClient', () => {
112
112
< SplitContext . Consumer >
113
113
{ ( ) => countSplitContext ++ }
114
114
</ SplitContext . Consumer >
115
- < SplitClient splitKey = { sdkBrowser . core . key } trafficType = { sdkBrowser . core . trafficType }
115
+ < SplitClient splitKey = { sdkBrowser . core . key }
116
116
/* Disabling update props is ineffective because the wrapping SplitFactoryProvider has them enabled: */
117
117
updateOnSdkReady = { false } updateOnSdkReadyFromCache = { false }
118
118
>
119
119
{ ( ) => { countSplitClient ++ ; return null } }
120
120
</ SplitClient >
121
121
{ React . createElement ( ( ) => {
122
122
// Equivalent to
123
- // - Using config key and traffic type : `const { client } = useSplitClient(sdkBrowser.core.key, sdkBrowser.core.trafficType, { att1: 'att1' });`
124
- // - Disabling update props, since the wrapping SplitFactoryProvider has them enabled: `const { client } = useSplitClient(undefined, undefined, { att1: 'att1' }, { updateOnSdkReady: false, updateOnSdkReadyFromCache: false });`
123
+ // - Using config key: `const { client } = useSplitClient({ splitKey: sdkBrowser.core.key, attributes: { att1: 'att1' } });`
124
+ // - Disabling update props, since the wrapping SplitFactoryProvider has them enabled: `const { client } = useSplitClient({ attributes: { att1: 'att1' }, updateOnSdkReady: false, updateOnSdkReadyFromCache: false });`
125
125
const { client } = useSplitClient ( { attributes : { att1 : 'att1' } } ) ;
126
126
expect ( client ) . toBe ( mainClient ) ; // Assert that the main client was retrieved.
127
127
expect ( client ! . getAttributes ( ) ) . toEqual ( { att1 : 'att1' } ) ; // Assert that the client was retrieved with the provided attributes.
@@ -141,7 +141,7 @@ describe('useSplitClient', () => {
141
141
{ ( ) => { countSplitClientWithUpdate ++ ; return null } }
142
142
</ SplitClient >
143
143
{ React . createElement ( ( ) => {
144
- useSplitClient ( { splitKey : sdkBrowser . core . key , trafficType : sdkBrowser . core . trafficType , updateOnSdkUpdate : true } ) . client ;
144
+ useSplitClient ( { splitKey : sdkBrowser . core . key , updateOnSdkUpdate : true } ) . client ;
145
145
countUseSplitClientWithUpdate ++ ;
146
146
return null ;
147
147
} ) }
0 commit comments