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
import pegScore from '../util/pegScore'; | |
it('disallows stack tipping', () => { | |
// set up redux store and connect a device component to it | |
const stores = bootStores( [ networkMiddleware(networkHandlers) ] ); | |
const { getDevice } = connectDeviceFactory( stores ); | |
const { appStore } = stores; | |
const handInitState = Pegging.initState.merge({ |
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 does our redux flow backwardsification for us | |
// subscribe -> resolve next state; run trigger function | |
export const getNextState = (store, fn = ()=>0) => (...args)=> ( | |
new Promise((s, j)=>{ | |
const f = store.subscribe(()=>{ | |
f(); | |
s(store.getState()); | |
}); |
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
it('adds a todo, then resets the device', (done) => { | |
// ... set up component and stores ... | |
// we're going to add a todo, then reset to the initState | |
expect( reduxStore.getState().get('todos').size ) | |
.toEqual( TodoList.initState.get('todos').size ); | |
// flow is backwards for async ops below | |
const clickResetAndCheck = ()=>{ |
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
it('can reset a TodoList', (done)=>{ | |
// .. set up component and store ... | |
const unsubscribe = reduxStore.subscribe(()=>{ | |
expect( reduxStore.getState().get('todos').size ) | |
.toEqual( TodoList.initState.get('todos').size ); | |
unsubscribe(); | |
done(); | |
}); |
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
import React from 'react'; | |
import { mount } from 'enzyme'; | |
import { | |
// tahini application dep | |
bootStores, | |
connectDeviceFactory, | |
networkMiddleware, |