1- import reduceReducers from "@internal/reduceReducers" ;
1+ import { reduceReducers } from 'redux'
22
33describe ( 'Utils' , ( ) => {
44 describe ( 'reduceReducers' , ( ) => {
5- const incrementReducer = ( state = 0 , action : { type : " increment" } ) =>
5+ const incrementReducer = ( state = 0 , action : { type : ' increment' } ) =>
66 action . type === 'increment' ? state + 1 : state
7- const decrementReducer = ( state = 0 , action : { type : " decrement" } ) =>
7+ const decrementReducer = ( state = 0 , action : { type : ' decrement' } ) =>
88 action . type === 'decrement' ? state - 1 : state
99
10- it ( " runs multiple reducers in sequence and returns the result of the last one" , ( ) => {
10+ it ( ' runs multiple reducers in sequence and returns the result of the last one' , ( ) => {
1111 const combined = reduceReducers ( incrementReducer , decrementReducer )
1212 expect ( combined ( 0 , { type : 'increment' } ) ) . toBe ( 1 )
1313 expect ( combined ( 1 , { type : 'decrement' } ) ) . toBe ( 0 )
1414 } )
15- it ( " accepts an initial state argument" , ( ) => {
15+ it ( ' accepts an initial state argument' , ( ) => {
1616 const combined = reduceReducers ( 2 , incrementReducer , decrementReducer )
17- expect ( combined ( undefined , { type : " increment" } ) ) . toBe ( 3 )
17+ expect ( combined ( undefined , { type : ' increment' } ) ) . toBe ( 3 )
1818 } )
19- it ( " can accept the preloaded state of the first reducer" , ( ) => {
19+ it ( ' can accept the preloaded state of the first reducer' , ( ) => {
2020 const parserReducer = ( state : number | string = 0 ) =>
2121 typeof state === 'string' ? parseInt ( state , 10 ) : state
2222
2323 const combined = reduceReducers ( parserReducer , incrementReducer )
24- expect ( combined ( "1" , { type : " increment" } ) ) . toBe ( 2 )
24+ expect ( combined ( '1' , { type : ' increment' } ) ) . toBe ( 2 )
2525
26- const combined2 = reduceReducers ( "1" , parserReducer , incrementReducer )
27- expect ( combined2 ( undefined , { type : " increment" } ) ) . toBe ( 2 )
26+ const combined2 = reduceReducers ( '1' , parserReducer , incrementReducer )
27+ expect ( combined2 ( undefined , { type : ' increment' } ) ) . toBe ( 2 )
2828 } )
29- it ( " accepts undefined as initial state" , ( ) => {
29+ it ( ' accepts undefined as initial state' , ( ) => {
3030 const combined = reduceReducers ( undefined , incrementReducer )
31- expect ( combined ( undefined , { type : " increment" } ) ) . toBe ( 1 )
31+ expect ( combined ( undefined , { type : ' increment' } ) ) . toBe ( 1 )
3232 } )
33- } ) ;
34- } )
33+ } )
34+ } )
0 commit comments