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
// @flow | |
import { put, call, takeLatest } from 'redux-saga/effects'; | |
import { login as loginApi } from '../api/login'; | |
import { | |
loginActionTypes, | |
loginLoading, | |
loginComplete, | |
loginInvalid | |
} from '../reducers/login/loginActions'; | |
import type { UserLogin } from '../reducers/login/loginActions'; |
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
// @flow | |
export const select = (selectors: Object) => (state: Object): Object => { | |
const keys = Object.keys(selectors); | |
const ret = {}; | |
keys.forEach(key => { | |
if (!selectors[key]){ | |
throw new Error( | |
` | |
Could not find key '${key}' in selectors. |
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 chalk from 'chalk'; | |
import * as fs from 'graceful-fs'; | |
import * as path from 'path'; | |
const SRC_DIR = path.join(__dirname, '../../../../src'); | |
const ALL_STORIES_DIR = path.join(__dirname, 'allStories'); | |
const ALL_STORIES_FILE = path.join(ALL_STORIES_DIR, 'index.ts'); // commit this file to git | |
const STORY_EXTENSION = '.story.tsx'; | |
const STORY_TEST_OUTPUT_EXTENSION = '.story.test.ts'; |
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
{ | |
"scripts": { | |
"prestorybookBuild": "tsc --lib ES7 --skipLibCheck --outDir ./src/test/storybook/storyshots ./src/test/storybook/storyshots/createTests.ts", | |
"prestorybook": "yarn prestorybookBuild && node src/test/storybook/storyshots/createTests.js", | |
"storybook": "storybook start -p 7007 -c \"src/test/storybook\"", | |
... | |
}, | |
"dependencies": { | |
"@storybook/addon-actions": "^3.4.3", | |
"@storybook/addon-links": "^3.4.3", |
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 Channel from '@storybook/channels'; | |
/** create mock channel so don't need websocket in jest tests */ | |
export const createMockChannel = () => { | |
const transport = { | |
setHandler: () => null, | |
send: () => null, | |
}; | |
return new Channel({ transport }); |
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 addons from '@storybook/addons'; | |
import { createMockChannel } from 'src/test/storybook/storyshots/mockChannel'; | |
// | |
// This runs to mock things required for the jest snapshot of a story | |
// | |
// In generated test, import this straight as `import 'src/test/storybook/storyshots/setupSnapshotTest'` | |
// Then require mocked storybook methods | |
// `const { configure, getStorybook } = require('@storybook/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
import { action } from '@storybook/addon-actions'; | |
import { Store } from 'redux'; | |
import { getInitialState } from '../state'; | |
/** | |
* Ready only mock store with addon actions upon dispatch | |
* | |
* Defaults to having a valid App initial state as imported via state.ts | |
*/ | |
export const getStorybookStore = (): Store<any> => { |
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 { storiesOf } from '@storybook/react-native'; | |
import React from 'react'; | |
import { Text, View } from 'react-native'; | |
const TestComponent: React.SFC<{}> = () => <Text>Hello world!</Text>; | |
/** | |
* A test story for testTemplate to use | |
* | |
* Test Decorator should not be in snapshot be design |
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
/////////////////// | |
// AUTO GENERATED by createTests.ts | |
// This is the storyshot for the story file | |
// One test file per story to help test watching | |
/////////////////// | |
import { getSnapshotFileName } from '@storybook/addon-storyshots'; | |
import { shallow } from 'enzyme'; | |
import toJson from 'enzyme-to-json'; | |
import React from 'react'; |
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 { configure, getStorybookUI } from '@storybook/react-native'; | |
import React from 'react'; | |
import { getConfig } from 'src/config'; | |
import { | |
allStories, | |
loadStories, | |
} from 'src/test/storybook/storyshots/allStories'; | |
/** | |
* init storybook UI on app startup and returns component ready, but dont display yet |
OlderNewer