A Redux-Saga test runner for Mocha
- Switching the order of instructions should be easy
- Associate instructions with their results
- Changing instruction results should be easy
| a = {b: 1, c:{ d:3 }} | |
| z = Object.assign({}, a) | |
| z.c.d = 4 | |
| console.log(a.c.d) // 4 |
| javascript:(function()%7Bvar%20table%20%3D%20document.getElementsByTagName('table')%5B2%5D%3Bvar%20rows%20%3D%20table.getElementsByTagName('tr')%3Bvar%20parseTime%20%3D%20function(rawDateTime%2C%20offset)%7Bvar%20tomorrow%20%3D%20new%20Date()%3Btomorrow.setDate(tomorrow.getDate()%20%2B%20offset)%3Bvar%20splitDateTime%20%3D%20rawDateTime.split('%5Cn%20%20')%3Bvar%20isPM%20%3D%20splitDateTime%5B1%5D.indexOf('pm')%20%3E%20-1%3Bvar%20date%20%3D%20splitDateTime%5B0%5D.split('%2F')%3Bvar%20month%20%3D%20parseInt(date%5B0%5D)%20-%201%3Bvar%20day%20%3D%20parseInt(date%5B1%5D)%3Bvar%20year%20%3D%20parseInt(date%5B2%5D)%3Bvar%20time%20%3D%20splitDateTime%5B1%5D.split('.')%3Bvar%20hour%20%3D%20parseInt(time%5B0%5D)%3Bif(isPM%20%26%26%20hour%20%3C%2012)%7Bhour%20%2B%3D%2012%3B%7Dvar%20min%20%3D%20parseInt(time%5B1%5D)%3Bif(tomorrow.getMonth()%20%3D%3D%3D%20month%20%26%26%20tomorrow.getDate()%20%3D%3D%3D%20day)%20%7Breturn%20new%20Date(year%2C%20month%2C%20day%2C%20hour%2C%20min)%3B%7D%7D%3Bvar%20s%20%3D%20%7Bcontainer%3A |
| Connection to localhost port 8081 [tcp/sunproxyadmin] succeeded! | |
| Port 8081 already in use, packager is either not running or not running correctly | |
| Command /bin/sh failed with exit code 2 |
| BEFORE THREAD DOWNLOAD REFACTOR | |
| | ---------------------------------------------------------------------------------------------------- 8765 total | |
| configure-store | ------------------ 1598ms | |
| get-stored-stat | ----------------- 1567ms | |
| create-store... | 7ms | |
| run-saga-middle | 23ms | |
| bootstrap...... | 53ms | |
| download-device | ------- 688ms | |
| get-devices.... | ------- 616ms | |
| get-store...... | ---- 396ms |
| // In test file | |
| const spy = effectSpy(generator) | |
| .next('init') | |
| .next('getToken', token) // name and pass in yield values | |
| .next('getUpdatedFooBars', fooBars) | |
| .next('putFooBars'); | |
| // in beforeEach | |
| mySpyRun = spy.run({ |
| // Having some sort of feature flags allows us to | |
| // - write centralized logic around when to show features | |
| // - develop features in smaller pieces behind feature flags | |
| // - turn on/off features at will | |
| // In a view, effect, whereever | |
| import features from '../features' | |
| if (features('showFooBar')) { | |
| // display FooBar |
| // It gets hard to test combined selectors after a while. | |
| // The dependency chains run deep. To get around this we | |
| // can test the callback function seperately from the rest | |
| // of the selector, but that leaves a testing gap. | |
| // In order to test that createSelector gets called with the | |
| // right stuff, we could do something like this | |
| // WARNING UNTESTED CODE |
| 0 == null; // false | |
| '' == null; // false | |
| undefined == null; // true |
| // my-reducer.js | |
| function myReducer(plugins, state, action) { | |
| // ... | |
| } | |
| // reducers.js | |
| import { myReducer } from './my-reducer'; | |
| export const reducers = { | |
| myReducers, |