@@ -3,10 +3,17 @@ import * as redux from 'redux'
3
3
import * as devtools from 'redux-devtools-extension'
4
4
5
5
import thunk from 'redux-thunk'
6
+ import immutableStateInvariant from 'redux-immutable-state-invariant'
6
7
7
8
describe ( 'getDefaultMiddleware' , ( ) => {
8
- it ( 'returns an array with redux-thunk' , ( ) => {
9
- expect ( getDefaultMiddleware ( ) ) . toEqual ( [ thunk ] )
9
+ it ( 'returns an array with only redux-thunk in production' , ( ) => {
10
+ expect ( getDefaultMiddleware ( true ) ) . toEqual ( [ thunk ] )
11
+ } )
12
+
13
+ it ( 'returns an array with additional middleware in development' , ( ) => {
14
+ const middleware = getDefaultMiddleware ( false ) ;
15
+ expect ( middleware [ middleware . length - 1 ] ) . toEqual ( thunk )
16
+ expect ( middleware . length ) . toBeGreaterThan ( 1 ) ;
10
17
} )
11
18
} )
12
19
@@ -16,14 +23,15 @@ describe('configureStore', () => {
16
23
jest . spyOn ( redux , 'compose' )
17
24
jest . spyOn ( redux , 'createStore' )
18
25
jest . spyOn ( devtools , 'composeWithDevTools' )
26
+
19
27
function reducer ( ) { }
20
28
21
29
beforeEach ( ( ) => jest . clearAllMocks ( ) )
22
30
23
31
describe ( 'given a function reducer' , ( ) => {
24
32
it ( 'calls createStore with the reducer' , ( ) => {
25
33
expect ( configureStore ( { reducer } ) ) . toBeInstanceOf ( Object )
26
- expect ( redux . applyMiddleware ) . toHaveBeenCalledWith ( thunk )
34
+ expect ( redux . applyMiddleware ) . toHaveBeenCalled ( )
27
35
expect ( devtools . composeWithDevTools ) . toHaveBeenCalled ( )
28
36
expect ( redux . createStore ) . toHaveBeenCalledWith (
29
37
reducer ,
@@ -42,7 +50,7 @@ describe('configureStore', () => {
42
50
}
43
51
expect ( configureStore ( { reducer } ) ) . toBeInstanceOf ( Object )
44
52
expect ( redux . combineReducers ) . toHaveBeenCalledWith ( reducer )
45
- expect ( redux . applyMiddleware ) . toHaveBeenCalledWith ( thunk )
53
+ expect ( redux . applyMiddleware ) . toHaveBeenCalled ( )
46
54
expect ( devtools . composeWithDevTools ) . toHaveBeenCalled ( )
47
55
expect ( redux . createStore ) . toHaveBeenCalledWith (
48
56
expect . any ( Function ) ,
@@ -94,7 +102,7 @@ describe('configureStore', () => {
94
102
expect ( configureStore ( { devTools : false , reducer } ) ) . toBeInstanceOf (
95
103
Object
96
104
)
97
- expect ( redux . applyMiddleware ) . toHaveBeenCalledWith ( thunk )
105
+ expect ( redux . applyMiddleware ) . toHaveBeenCalled ( )
98
106
expect ( redux . compose ) . toHaveBeenCalled ( )
99
107
expect ( redux . createStore ) . toHaveBeenCalledWith (
100
108
reducer ,
@@ -107,7 +115,7 @@ describe('configureStore', () => {
107
115
describe ( 'given preloadedState' , ( ) => {
108
116
it ( 'calls createStore with preloadedState' , ( ) => {
109
117
expect ( configureStore ( { reducer } ) ) . toBeInstanceOf ( Object )
110
- expect ( redux . applyMiddleware ) . toHaveBeenCalledWith ( thunk )
118
+ expect ( redux . applyMiddleware ) . toHaveBeenCalled ( )
111
119
expect ( devtools . composeWithDevTools ) . toHaveBeenCalled ( )
112
120
expect ( redux . createStore ) . toHaveBeenCalledWith (
113
121
reducer ,
@@ -123,7 +131,7 @@ describe('configureStore', () => {
123
131
expect ( configureStore ( { enhancers : [ enhancer ] , reducer } ) ) . toBeInstanceOf (
124
132
Object
125
133
)
126
- expect ( redux . applyMiddleware ) . toHaveBeenCalledWith ( thunk )
134
+ expect ( redux . applyMiddleware ) . toHaveBeenCalled ( )
127
135
expect ( devtools . composeWithDevTools ) . toHaveBeenCalled ( )
128
136
expect ( redux . createStore ) . toHaveBeenCalledWith (
129
137
reducer ,
0 commit comments