This file contains hidden or 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
var React = require.requireActual('react') | |
var assign = require.requireActual('object-assign') | |
function stubContext(Component, context, props) { | |
var _component = Component | |
var _context = context | |
var _props = props | |
var _contextTypes = {} | |
Object.keys(_context).forEach((key) => { |
This file contains hidden or 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
var React = require.requireActual('react') | |
var assign = require.requireActual('object-assign') | |
function stubContext(Component, context) { | |
var _component = Component | |
var _context = context | |
var _contextTypes = {} | |
Object.keys(_context).forEach((key) => { | |
_contextTypes[key] = React.PropTypes.any |
This file contains hidden or 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
var React = require('react'); | |
var assign = require('object-assign'); | |
function createStubbedContextComponent(BaseComponent, context) { | |
var _contextTypes = {}, _context = context; | |
Object.keys(_context).forEach(function(key) { | |
_contextTypes[key] = React.PropTypes.any; | |
}); |
This file contains hidden or 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
jest.dontMock('../'); | |
function noop() {} | |
describe('React Router Context Test', function() { | |
var React, Router, TestUtils, stubContext, TestHandler; | |
beforeEach(function() { | |
React = require.requireActual('react/addons'); | |
TestUtils = React.addons.TestUtils; |
This file contains hidden or 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 d3 = { svg: { axis: d3axis } }; | |
function noop(x) { console.log('called with', x); return d3axis(); } | |
function d3axis() { return { scale: noop, range: noop } } | |
class Axis { | |
constructor(obj) { | |
this.props = obj || {}; | |
} | |
render() { |
This file contains hidden or 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
var _ = require('lodash'); | |
var fs = require('fs'); | |
var path = require('path'); | |
var byline = require('byline'); | |
var anagrams = {}, matchers = []; | |
function findAnagrams (filePath, cb) { | |
byline(fs.createReadStream(filePath, { encoding: 'utf8' })) | |
.on('data', process) |
This file contains hidden or 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
70-odd | |
able | |
above | |
abreast | |
abrupt | |
absent | |
abstracted | |
absurd | |
accessible | |
accident |
This file contains hidden or 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
{ type: 'FETCH_POSTS' } | |
{ type: 'FETCH_POSTS', status: 'error', error: 'Oops' } | |
{ type: 'FETCH_POSTS', status: 'success', response: { ... } } |
This file contains hidden or 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 fetch from 'isomorphic-fetch' | |
import QS from 'qs' | |
const URL_PREFIX = 'https://www.googleapis.com/youtube/v3' | |
const PLAYLIST_ID = 'UUANLZYMidaCbLQFWXBC95Jg' | |
const API_KEY = 'XXX' | |
const DEFAULT_PART = 'contentDetails' | |
const DEFAULT_MAX_RESULTS = '50' | |
function buildUrl(path, params) { |
This file contains hidden or 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 _fetch from 'isomorphic-fetch' | |
import checkStatus from '../src/utils/check-status' | |
import parseBody from '../src/utils/parse-body' | |
import jsonFile from 'jsonfile' | |
let cache = {} | |
const cachePath = __dirname + '/cache.json' | |
export default function fetch (url, ignoreCache = false) { | |
if (!ignoreCache) { |