Skip to content

Instantly share code, notes, and snippets.

View ofirdagan's full-sized avatar

Ofir Dagan ofirdagan

View GitHub Profile
@ofirdagan
ofirdagan / import.gist.js
Created December 19, 2018 16:08
Lazy Require Vs Imports
import MyComp from './MyComp';
ModuleRegistry.registerComponent('MyComp', () => MyComp);
@ofirdagan
ofirdagan / require.gist.js
Created December 19, 2018 16:06
Lazy Require Vs Imports
ModuleRegistry.registerComponent('MyComp', () => {
const MyComp = require('./MyComp');
reutrn MyComp;
});
@ofirdagan
ofirdagan / gist:9ad5de348a0c18e8ab9002d264febdf5
Created October 3, 2017 15:33
What will that print? - async
(async function wrapper() {
const foo = async () => {
return true;
};
const goo = async () => {
return Promise.resolve(true);
};
@ofirdagan
ofirdagan / dummy-driver.spec.js
Created November 12, 2016 21:48
enzyme drivers driver
// setup the driver in the beforeEach
beforeEach(() => {
driver = new MyDriver({
//the path is relative to the src/ folder (you can change it if you need. see api on github)
path: 'components/dummy-react-native-component',
mocks: {},
});
});
//The driver extends the React Native Driver. We also support regular react with BaseDriver
@ofirdagan
ofirdagan / dummy-component-spec2.js
Last active November 13, 2016 08:43
enzyme drivers second test
it('should tapOn', () => {
const tapSpy = jasmine.createSpy('tap');
//given
driver.render({text: 'hello driver', onTap: tapSpy});
//when
driver.tap();
//then
expect(tapSpy).toHaveBeenCalled();
});
@ofirdagan
ofirdagan / dummy.component.spec.js
Created November 12, 2016 21:42
enzyme-drivers-test
it('should render component', () => {
//given
driver.render({text: 'It works!'});
//then
expect(driver.text).toBe('It works!');
});
@ofirdagan
ofirdagan / gist:5c0e046e0975ef5ff6b256cbdc5f886e
Last active November 12, 2016 21:41
enzyme-drivers-simple-react-native-component-for-medium
export default function DummyReactNativeComponent({text, onTap}) {
return (
<View>
<Text testID="myText">Some Text</Text>
<Text testID="textFromProp" onPress={onTap}>{text}</Text>
</View>
);
}
@ofirdagan
ofirdagan / google-survey
Created July 10, 2014 07:04
Google Survey Test
<html>
<head>
<script src="http://survey.g.doubleclick.net/async_survey?site=63uzockooaopsig3i33sh6qez4"></script>
</head>
<body>
Hello
</body>
</html>