@@ -173,13 +173,14 @@ describe('Container', () => {
173
173
expect ( mockOnContainerCleanupInner ) . toHaveBeenCalledTimes ( 1 ) ;
174
174
} ) ;
175
175
176
- it ( 'should not cleanup from global on unmount if still listeners' , ( ) => {
176
+ it ( 'should not cleanup from global on unmount if still listeners' , async ( ) => {
177
177
storeStateMock . subscribe . mockReturnValue ( jest . fn ( ) ) ;
178
178
storeStateMock . listeners . mockReturnValue ( [ jest . fn ( ) ] ) ;
179
179
const Subscriber = createSubscriber ( Store ) ;
180
180
const children = < Subscriber > { ( ) => null } </ Subscriber > ;
181
181
const wrapper = mount ( < Container scope = "s1" > { children } </ Container > ) ;
182
182
wrapper . unmount ( ) ;
183
+ await Promise . resolve ( ) ;
183
184
expect ( defaultRegistry . deleteStore ) . not . toHaveBeenCalled ( ) ;
184
185
} ) ;
185
186
@@ -193,6 +194,14 @@ describe('Container', () => {
193
194
expect ( defaultRegistry . deleteStore ) . toHaveBeenCalledWith ( Store , 's1' ) ;
194
195
} ) ;
195
196
197
+ it ( 'should not cleanup from global on unmount if not scoped' , async ( ) => {
198
+ storeStateMock . listeners . mockReturnValue ( [ ] ) ;
199
+ const wrapper = mount ( < Container isGlobal > Content</ Container > ) ;
200
+ wrapper . unmount ( ) ;
201
+ await Promise . resolve ( ) ;
202
+ expect ( defaultRegistry . deleteStore ) . not . toHaveBeenCalled ( ) ;
203
+ } ) ;
204
+
196
205
it ( 'should call Container onInit on first render' , ( ) => {
197
206
const Subscriber = createSubscriber ( Store ) ;
198
207
const renderPropChildren = jest . fn ( ) . mockReturnValue ( null ) ;
0 commit comments