You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Darin Haener edited this page Oct 5, 2015
·
2 revisions
#Testing Alt Stores
Testing your stores is super simple with this wrapper:
importTestStorefrom'legit-tests/alt/store'importMyStorefrom'path/to/your/store'importMyActionsfrom'path/to/your/actions'describe('My Store',()=>{it('should do all the things',()=>{TestStore(MyStore,MyActions).addTodo({text: 'Get Milk',completed: false}).test(({ state })=>{expect(state.todos[0].text).to.equal('Get Milk')})})})
The wrapper will attempt to proxy any function calls other than test to your actions, so you can chain any actions you have defined right onto the test object and it will just work.
The only object returned on the test method is the store, so any functions or objects available on the store singleton can be retrieved in the test callback.