-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e55a84b
commit 5e18e9c
Showing
3 changed files
with
55 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { assert } from 'chai' | ||
import Alt from '../' | ||
import sinon from 'sinon' | ||
|
||
const alt = new Alt() | ||
|
||
const actions = alt.generateActions('fire') | ||
|
||
const store = alt.createStore({ | ||
state: 21, | ||
|
||
displayName: 'ValueStore', | ||
|
||
reduce(state, payload) { | ||
return state + 1 | ||
} | ||
}) | ||
|
||
export default { | ||
'value stores': { | ||
beforeEach() { | ||
alt.recycle() | ||
}, | ||
|
||
'stores can contain state as any value'(done) { | ||
assert(store.state === 21, 'store state is value') | ||
assert(store.getState() === 21, 'getState returns value too') | ||
|
||
store.listen((state) => { | ||
assert(state === 22, 'incremented store state') | ||
done() | ||
}) | ||
|
||
assert(JSON.parse(alt.takeSnapshot()).ValueStore === 21, 'snapshot ok') | ||
|
||
actions.fire() | ||
}, | ||
} | ||
} |