11import {
22 createStore ,
33 action ,
4- unstable_effectOn ,
4+ effectOn ,
55 thunk ,
66 thunkOn ,
77 actionOn ,
@@ -36,7 +36,7 @@ test('fires when the dependencies change', () => {
3636 addTodo : action ( ( state , payload ) => {
3737 state . todos . push ( payload ) ;
3838 } ) ,
39- onTodosChanged : unstable_effectOn (
39+ onTodosChanged : effectOn (
4040 [ ( state ) => state . todos , ( state ) => state . foo ] ,
4141 ( ) => {
4242 fired = true ;
@@ -45,7 +45,7 @@ test('fires when the dependencies change', () => {
4545 } ) ;
4646
4747 // ACT
48- store . getActions ( ) . addTodo ( 'add unstable_effectOn api' ) ;
48+ store . getActions ( ) . addTodo ( 'add effectOn api' ) ;
4949
5050 // ASSERT
5151 expect ( fired ) . toBe ( true ) ;
@@ -69,7 +69,7 @@ test('does not fire when the dependencies have not changed', () => {
6969 setFoo : action ( ( state , payload ) => {
7070 state . foo = payload ;
7171 } ) ,
72- onTodosChanged : unstable_effectOn ( [ ( state ) => state . todos ] , ( ) => {
72+ onTodosChanged : effectOn ( [ ( state ) => state . todos ] , ( ) => {
7373 fired = true ;
7474 } ) ,
7575 } ) ;
@@ -89,7 +89,7 @@ test('fires when store dependency changes', () => {
8989 setFired : action ( ( state , payload ) => {
9090 state . fired = payload ;
9191 } ) ,
92- onTodosChanged : unstable_effectOn (
92+ onTodosChanged : effectOn (
9393 [ ( state , storeState ) => storeState . todos ] ,
9494 ( actions ) => {
9595 actions . setFired ( true ) ;
@@ -123,7 +123,7 @@ test('it receives the local actions', () => {
123123 setFired : action ( ( state , payload ) => {
124124 state . fired = payload ;
125125 } ) ,
126- onTodosChanged : unstable_effectOn ( [ ( state ) => state . todos ] , ( actions ) => {
126+ onTodosChanged : effectOn ( [ ( state ) => state . todos ] , ( actions ) => {
127127 actions . setFired ( true ) ;
128128 } ) ,
129129 } ) ;
@@ -144,7 +144,7 @@ test('it receives the local actions for nested model', () => {
144144 nested : {
145145 fired : false ,
146146 todos : [ ] ,
147- onTodosChanged : unstable_effectOn ( [ ( state ) => state . todos ] , ( actions ) => {
147+ onTodosChanged : effectOn ( [ ( state ) => state . todos ] , ( actions ) => {
148148 actions . setFired ( true ) ;
149149 } ) ,
150150 addTodo : action ( ( state , payload ) => {
@@ -153,7 +153,7 @@ test('it receives the local actions for nested model', () => {
153153 setFired : action ( ( state , payload ) => {
154154 state . fired = payload ;
155155 } ) ,
156- }
156+ } ,
157157 } ) ;
158158
159159 // ASSERT
@@ -184,12 +184,9 @@ test('change argument is as expected', () => {
184184 actions . setTwo ( target . payload ) ;
185185 } ,
186186 ) ,
187- onStateChanged : unstable_effectOn (
188- [ ( state ) => state . two ] ,
189- ( actions , change ) => {
190- actualChange = change ;
191- } ,
192- ) ,
187+ onStateChanged : effectOn ( [ ( state ) => state . two ] , ( actions , change ) => {
188+ actualChange = change ;
189+ } ) ,
193190 } ) ;
194191
195192 // ACT
@@ -216,7 +213,7 @@ test('getState is exposed in helpers', async () => {
216213 setString : action ( ( state , payload ) => {
217214 state . string = payload ;
218215 } ) ,
219- onStateChanged : unstable_effectOn (
216+ onStateChanged : effectOn (
220217 [ ( state ) => state . string ] ,
221218 ( actions , change , { getState } ) => {
222219 actualState = getState ( ) ;
@@ -245,7 +242,7 @@ test('getStoreState is exposed in helpers', async () => {
245242 setString : action ( ( state , payload ) => {
246243 state . string = payload ;
247244 } ) ,
248- onStateChanged : unstable_effectOn (
245+ onStateChanged : effectOn (
249246 [ ( state ) => state . string ] ,
250247 ( actions , change , { getStoreState } ) => {
251248 actualStoreState = getStoreState ( ) ;
@@ -276,7 +273,7 @@ test('meta values are exposed in helpers', async () => {
276273 setString : action ( ( state , payload ) => {
277274 state . string = payload ;
278275 } ) ,
279- onStateChanged : unstable_effectOn (
276+ onStateChanged : effectOn (
280277 [ ( state ) => state . string ] ,
281278 ( actions , change , { meta } ) => {
282279 actualMeta = meta ;
@@ -308,7 +305,7 @@ test('injections are exposed in helpers', async () => {
308305 setString : action ( ( state , payload ) => {
309306 state . string = payload ;
310307 } ) ,
311- onStateChanged : unstable_effectOn (
308+ onStateChanged : effectOn (
312309 [ ( state ) => state . string ] ,
313310 ( actions , change , helpers ) => {
314311 actualInjections = helpers . injections ;
@@ -338,7 +335,7 @@ test('dispatch is exposed in helpers', async () => {
338335 setString : action ( ( state , payload ) => {
339336 state . string = payload ;
340337 } ) ,
341- onStateChanged : unstable_effectOn (
338+ onStateChanged : effectOn (
342339 [ ( state ) => state . string ] ,
343340 ( actions , change , helpers ) => {
344341 actualDispatch = helpers . dispatch ;
@@ -363,7 +360,7 @@ test('getStoreActions are exposed in helpers', async () => {
363360 setString : action ( ( state , payload ) => {
364361 state . string = payload ;
365362 } ) ,
366- onStateChanged : unstable_effectOn (
363+ onStateChanged : effectOn (
367364 [ ( state ) => state . string ] ,
368365 ( actions , change , helpers ) => {
369366 helpers . getStoreActions ( ) . nested . setString ( 'three' ) ;
@@ -391,12 +388,9 @@ test('dispatches actions to represent a succeeded effect', () => {
391388 setNumber : action ( ( state , payload ) => {
392389 state . number = payload ;
393390 } ) ,
394- onStateChanged : unstable_effectOn (
395- [ ( state ) => state . string ] ,
396- ( actions ) => {
397- actions . setNumber ( 2 ) ;
398- } ,
399- ) ,
391+ onStateChanged : effectOn ( [ ( state ) => state . string ] , ( actions ) => {
392+ actions . setNumber ( 2 ) ;
393+ } ) ,
400394 } ,
401395 } ;
402396 const trackActions = trackActionsMiddleware ( ) ;
@@ -448,7 +442,7 @@ describe('errors', () => {
448442 doAsync : thunk ( ( ) => {
449443 throw err ;
450444 } ) ,
451- onStateChanged : unstable_effectOn (
445+ onStateChanged : effectOn (
452446 [ ( state ) => state . string ] ,
453447 async ( actions , change ) => {
454448 await actions . doAsync ( change . action . payload ) ;
@@ -504,7 +498,7 @@ test('effects cannot be targetted by actionOn', async () => {
504498 setString : action ( ( state , payload ) => {
505499 state . string = payload ;
506500 } ) ,
507- onStateChanged : unstable_effectOn ( [ ( state ) => state . string ] , ( ) => {
501+ onStateChanged : effectOn ( [ ( state ) => state . string ] , ( ) => {
508502 // do nothing
509503 } ) ,
510504 invalidActionOn : actionOn (
@@ -535,7 +529,7 @@ test('effects cannot be targetted by thunkOn', async () => {
535529 setString : action ( ( state , payload ) => {
536530 state . string = payload ;
537531 } ) ,
538- onStateChanged : unstable_effectOn ( [ ( state ) => state . string ] , ( ) => {
532+ onStateChanged : effectOn ( [ ( state ) => state . string ] , ( ) => {
539533 // do nothing
540534 } ) ,
541535 invalidThunkOn : actionOn (
@@ -567,7 +561,7 @@ test('synchronous effect with synchronous dispose executes as expected', () => {
567561 setFoo : action ( ( state , payload ) => {
568562 state . foo = payload ;
569563 } ) ,
570- onFooChange : unstable_effectOn ( [ ( state ) => state . foo ] , ( ) => {
564+ onFooChange : effectOn ( [ ( state ) => state . foo ] , ( ) => {
571565 executionId += 1 ;
572566 executions . push ( { id : executionId , type : 'effect' } ) ;
573567 return ( ) => {
@@ -601,7 +595,7 @@ test('synchronous effect with asynchronous dispose executes as expected', async
601595 setFoo : action ( ( state , payload ) => {
602596 state . foo = payload ;
603597 } ) ,
604- onFooChange : unstable_effectOn ( [ ( state ) => state . foo ] , ( ) => {
598+ onFooChange : effectOn ( [ ( state ) => state . foo ] , ( ) => {
605599 executionId += 1 ;
606600 const id = executionId ;
607601 executions . push ( { id, type : 'effect' } ) ;
0 commit comments