-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow customizing your state property key
- Loading branch information
1 parent
c7cf466
commit ff9e4dd
Showing
6 changed files
with
43 additions
and
5 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
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { assert } from 'chai' | ||
import Alt from '../dist/alt-with-runtime' | ||
|
||
const alt = new Alt({ | ||
stateKey: 'state' | ||
}) | ||
|
||
class Store { | ||
static displayName: 'CustomStateKeyStore' | ||
|
||
constructor() { | ||
this.foo = 1 | ||
this.state = { yes: 2 } | ||
} | ||
} | ||
|
||
const store = alt.createStore(Store) | ||
|
||
export default { | ||
'Custom State Key': { | ||
'setting a custom key for declaring state'() { | ||
assert.isUndefined(store.getState().foo, 'foo is private') | ||
assert.isDefined(store.getState().yes, 'yes is part of state') | ||
}, | ||
} | ||
} |