@@ -4,20 +4,16 @@ import { SET_SHARED } from "../../../constants";
4
4
import { setStore , getStore } from "../store" ;
5
5
6
6
describe ( "store registry" , ( ) => {
7
- const ORIGINAL_NODE_ENV = process . env . NODE_ENV ;
8
-
9
7
const debugSpy = jest . spyOn ( console , "debug" ) . mockImplementation ( ( ) => { } ) ;
10
8
const errorSpy = jest . spyOn ( console , "error" ) . mockImplementation ( ( ) => { } ) ;
11
9
12
10
beforeEach ( ( ) => {
13
11
setStore ( null ) ;
14
- process . env . NODE_ENV = ORIGINAL_NODE_ENV ;
15
12
debugSpy . mockClear ( ) ;
16
13
errorSpy . mockClear ( ) ;
17
14
} ) ;
18
15
19
16
afterAll ( ( ) => {
20
- process . env . NODE_ENV = ORIGINAL_NODE_ENV ;
21
17
debugSpy . mockRestore ( ) ;
22
18
errorSpy . mockRestore ( ) ;
23
19
} ) ;
@@ -68,71 +64,7 @@ describe("store registry", () => {
68
64
} ) ;
69
65
70
66
describe ( "namespace" , ( ) => {
71
- it ( ".getState in NODE_ENV=development" , ( ) => {
72
- setStore (
73
- configureStore ( [ ] ) ( {
74
- modules : {
75
- "my-feature" : {
76
- foo : "bat" ,
77
- } ,
78
- "my-other-feature" : {
79
- foo : "baz" ,
80
- } ,
81
- } ,
82
- env : { } ,
83
- shared : {
84
- beach : "bar" ,
85
- } ,
86
- } ) ,
87
- ) ;
88
-
89
- process . env . NODE_ENV = "development" ;
90
-
91
- const store = getStore ( ) . namespace ( "my-feature" ) ;
92
-
93
- expect ( typeof store . getState ) . toEqual ( "function" ) ;
94
-
95
- const state = store . getState ( ) ;
96
-
97
- expect ( state ) . toEqual ( store . getState ( ) ) ;
98
-
99
- expect ( state ) . toEqual ( {
100
- foo : "bat" ,
101
- env : { } ,
102
- shared : {
103
- beach : "bar" ,
104
- } ,
105
- } ) ;
106
- expect ( state . valueOf ( ) ) . toEqual ( {
107
- foo : "bat" ,
108
- env : { } ,
109
- shared : {
110
- beach : "bar" ,
111
- } ,
112
- } ) ;
113
- expect ( state . toString ( ) ) . toEqual ( "[object Object]" ) ;
114
- expect ( state . shared ) . toEqual ( { beach : "bar" } ) ;
115
- errorSpy . mockClear ( ) ;
116
-
117
- expect ( state . other ) . toBeUndefined ( ) ;
118
- expect ( errorSpy ) . toHaveBeenCalledWith ( 'module "my-feature" tried to access reducer "other" that it does not own.' ) ;
119
-
120
- expect ( "shared" in state ) . toEqual ( true ) ;
121
- expect ( "foo" in state ) . toEqual ( true ) ;
122
- expect ( "other" in state ) . toEqual ( false ) ;
123
-
124
- expect ( Reflect . ownKeys ( state ) ) . toEqual ( [ "foo" , "env" , "shared" ] ) ;
125
-
126
- state . foo = "mutation" ;
127
-
128
- expect ( ( ) => {
129
- state . shared . beach = "injection" ;
130
- } ) . toThrow ( TypeError ) ;
131
-
132
- expect ( state . shared . beach ) . toEqual ( "bar" ) ;
133
- } ) ;
134
-
135
- it ( ".getState in NODE_ENV=production" , ( ) => {
67
+ it ( ".getState" , ( ) => {
136
68
setStore (
137
69
configureStore ( [ ] ) ( {
138
70
modules : {
@@ -150,8 +82,6 @@ describe("store registry", () => {
150
82
} ) ,
151
83
) ;
152
84
153
- process . env . NODE_ENV = "production" ;
154
-
155
85
let store = getStore ( ) . namespace ( "my-feature" ) ;
156
86
157
87
expect ( typeof store . getState ) . toEqual ( "function" ) ;
0 commit comments