-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Data Module: Restrict the state access to the module registering the …
…reducer only
- Loading branch information
1 parent
5c33f6f
commit 7b6964a
Showing
5 changed files
with
44 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
import { registerReducer, getState } from '../'; | ||
import { registerReducer } from '../'; | ||
|
||
describe( 'store', () => { | ||
it( 'Should append reducers to the state', () => { | ||
const reducer1 = () => 'chicken'; | ||
const reducer2 = () => 'ribs'; | ||
|
||
registerReducer( 'red1', reducer1 ); | ||
expect( getState() ).toEqual( { red1: 'chicken' } ); | ||
const store = registerReducer( 'red1', reducer1 ); | ||
expect( store.getState() ).toEqual( 'chicken' ); | ||
|
||
registerReducer( 'red2', reducer2 ); | ||
expect( getState() ).toEqual( { | ||
red1: 'chicken', | ||
red2: 'ribs', | ||
} ); | ||
const store2 = registerReducer( 'red2', reducer2 ); | ||
expect( store2.getState() ).toEqual( 'ribs' ); | ||
} ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters