$ jscodeshift <path> -t assert-to-expect.js
$ jscodeshift <path> -t mocha-to-jest.js
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
export default function(target) { | |
const originalMethods = { | |
UNSAFE_componentWillMount: target.prototype.UNSAFE_componentWillMount || noop, | |
componentDidMount: target.prototype.componentDidMount || noop, | |
UNSAFE_componentWillUpdate: target.prototype.UNSAFE_componentWillUpdate || noop, | |
componentDidUpdate: target.prototype.componentDidUpdate || noop, | |
componentWillUnmount: target.prototype.componentWillUnmount || noop | |
}; |
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
/** | |
* Copyright (c) 2019 Paul Armstrong | |
*/ | |
import React from 'react'; | |
import { render } from 'react-testing-library'; | |
import Tooltip from '../Tooltip'; | |
import { Dimensions, MeasureOnSuccessCallback, View } from 'react-native'; | |
describe('Tooltip', () => { | |
let viewRef; |
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
/** | |
* Copyright (c) 2019 Paul Armstrong | |
*/ | |
import * as Theme from '../theme'; | |
import React from 'react'; | |
import { StyleProp, StyleSheet, TouchableOpacity, TouchableOpacityProps, View, ViewStyle } from 'react-native'; | |
interface Props { | |
children: React.ReactElement; | |
disabled?: boolean; |
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
export default function(target) { | |
const originalMethods = { | |
UNSAFE_componentWillMount: target.prototype.UNSAFE_componentWillMount || noop, | |
componentDidMount: target.prototype.componentDidMount || noop, | |
UNSAFE_componentWillUpdate: target.prototype.UNSAFE_componentWillUpdate || noop, | |
componentDidUpdate: target.prototype.componentDidUpdate || noop, | |
componentWillUnmount: target.prototype.componentWillUnmount || noop | |
}; | |
target.prototype.UNSAFE_componentWillMount = function(...args) { |
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
define(['modules/foo'], function (foo) { | |
describe('test foo', function () { | |
// ... | |
}); | |
}); |
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 HeartIcon = (props) => React.createElement('svg', { | |
...props, | |
dangerouslySetInnerHTML: { __html: '<g><path d="M38.723 12c-7.187 0-11.16 7.306-11.723 8.131C26.437 19.306 22.504 12 15.277 12 8.791 12 3.533 18.163 3.533 24.647 3.533 39.964 21.891 55.907 27 56c5.109-.093 23.467-16.036 23.467-31.353C50.467 18.163 45.209 12 38.723 12z"></path></g>' }, | |
viewBox: '0 0 54 72' | |
}); |
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
function memorySizeOf(obj) { | |
var bytes = 0; | |
function sizeOf(obj) { | |
if(obj !== null && obj !== undefined) { | |
switch(typeof obj) { | |
case 'number': | |
bytes += 8; | |
break; | |
case 'string': |
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
function memorySizeOf(obj) { | |
var bytes = 0; | |
function sizeOf(obj) { | |
if(obj !== null && obj !== undefined) { | |
switch(typeof obj) { | |
case 'number': | |
bytes += 8; | |
break; | |
case 'string': |
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 FetchStatus = { | |
FAILED: 'failed', | |
LOADED: 'loaded', | |
LOADING: 'loading', | |
NONE: 'none' | |
}; | |
class LoadingRenderer extends React.Component { | |
static propTypes = { | |
fetchStatus: React.PropTypes.oneOf(Object.values(FetchStatus)).isRequired, |