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 mockery from ‘mockery’ | |
// inject __DEV__ | |
global.__DEV__ = true | |
// We enable mockery and leave it on. | |
mockery.enable() | |
// Silence mockery's warnings as we'll opt-in to mocks instead | |
mockery.warnOnUnregistered(false) |
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 test from 'ava' | |
import saga, { acquireDataFromSomewhere } from '../TimeToShineSaga' | |
import { put, call, select } from 'redux-saga/effects' | |
test('the saga works', t => { | |
// grab the saga (generator function) to test | |
const gen = saga() | |
// a sugary helper to clean up our assertions below | |
const step = (mockLastYield) => gen.next(mockLastYield).value |
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 { put, call, select } from 'redux-saga/effects' | |
export function acquireDataFromSomewhere (numberOfThings) { | |
return new Promise((resolve, reject) => { | |
resolve(`here are ${numberOfThings} things`) | |
}) | |
} | |
// Fires when we see TIME_TO_SHINE come through. | |
// Its pretty random what we do here. |
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 test from 'ava' | |
import reducer from './CounterReducer' | |
test('increment from a fresh state', t => { | |
const state = reducer(undefined, { type: 'INCREMENT' }) | |
t.deepEqual(state, { value: 1 }) | |
}) | |
test('increment from a previous state', t => { | |
const state = reducer({ value: 68 }, { type: 'INCREMENT' }) |
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
const INITIAL_STATE = { value: 0 } | |
// do something important & significant | |
const increment = (state, action) => ({ value: state.value + 1 }) | |
// our reducer | |
export default (state = INITIAL_STATE, action) => { | |
switch (action.type) { | |
case 'INCREMENT': return increment(state, action) | |
default: return state |
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 test from ‘ava’ | |
import greeter from ‘./Greeter’ | |
test(‘says hello’, t => { | |
t.is(greeter(‘World’), ‘Hello World!’) | |
}) |
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
// when given a name, it’ll enthusiastically greet them!!!!! | |
export default (name) => `Hello ${name}!` |
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
Show hidden characters
{ | |
“presets”: [“react-native”] | |
} |
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
"ava": { | |
"babel": "inherit", | |
"files": [ "Tests/**/*.js", "!Tests/Setup.js" ], | |
"require": [ | |
"babel-register", | |
"babel-polyfill", | |
"react-native-mock/mock", | |
"./Tests/Setup" | |
] | |
} |
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
$ANDROID_HOME/platform-tools/adb devices | grep '\\t' | awk '{print $1}' | sed 's/\\s//g' | xargs -I {} $ANDROID_HOME/platform-tools/adb -s {} shell input keyevent 82 |