Skip to content

Instantly share code, notes, and snippets.

View ManuViola77's full-sized avatar

Manuela Viola ManuViola77

  • Montevideo, Uruguay
View GitHub Profile
@ManuViola77
ManuViola77 / index.html
Last active August 13, 2020 21:23
detect poses with posenet
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.1/p5.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.1/addons/p5.dom.min.js"></script>
<!-- Load TensorFlow.js -->
<script src="https://unpkg.com/@tensorflow/tfjs"></script>
<!-- Load Posenet -->
<script src="https://unpkg.com/@tensorflow-models/posenet"></script>
<script src="sketch.js"></script>
</head>
@ManuViola77
ManuViola77 / SecondaryScreen.spec.js
Last active August 12, 2020 19:09
SecondaryScreen test
import {act, fireEvent, waitFor} from '@testing-library/react-native';
import {screenParameters} from '../extras/data';
import {renderWithNavigation} from '../extras/helpers';
import SecondaryScreen from '../../src/screens/SecondaryScreen';
import MainScreen from '../../src/screens/MainScreen';
describe('<SecondaryScreen />', () => {
let wrapper;
@ManuViola77
ManuViola77 / data.js
Created August 11, 2020 22:43
AnotherScreen parameters
export const screenParameters = {
paramOne: 'This is a parameter that is a text',
paramTwo: {
content: 'This is a parameter that is an object with a content',
},
};
@ManuViola77
ManuViola77 / MainScreen.spec.js
Last active August 12, 2020 19:11
MainScreen test
import {act, fireEvent, waitFor} from '@testing-library/react-native';
import {Alert} from 'react-native';
import AppStack from '../../src/navigators/AppStack';
import {renderWithNavigation} from '../extras/helpers';
describe('<MainScreen />', () => {
let wrapper;
beforeEach(() => {
@ManuViola77
ManuViola77 / helpers.js
Created August 11, 2020 22:13
Navigation helper
import React from 'react';
import {NavigationContainer} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';
import {render} from '@testing-library/react-native';
const Stack = createStackNavigator();
const renderOtherComponents = (otherComponents, screenConfig = {}) => {
return otherComponents.map(({name, component}) => {
return (
@ManuViola77
ManuViola77 / jest.config.js
Created August 11, 2020 21:16
Jest configuration
module.exports = {
preset: 'react-native',
modulePathIgnorePatterns: ['extras'],
setupFiles: [
'<rootDir>/node_modules/react-native-gesture-handler/jestSetup.js',
],
transformIgnorePatterns: [
'node_modules/(?!(jest-)?react-native|react-(native|universal|navigation)-(.*)|@react-native-community/(.*)|@react-navigation/(.*)|bs-platform|@rootstrap/redux-tools)',
],
verbose: true,
@ManuViola77
ManuViola77 / react-native-image-crop-picker.js
Last active August 10, 2020 22:57
Simple Image Picker Mock
export default {
openPicker: jest.fn().mockImplementation(() => Promise.resolve(result))
};
@ManuViola77
ManuViola77 / react-native-image-crop-picker.js
Last active February 12, 2021 05:11
Complex Image Picker Mock
export default {
openPicker: jest
.fn(() => Promise.resolve(result)) // default implementation
.mockImplementationOnce(() => Promise.reject(result)) // first time is called
.mockImplementationOnce(() => Promise.resolve(result)), // second time is called
};
@ManuViola77
ManuViola77 / react-native-config.js
Last active August 10, 2020 22:59
Api URL mock
export default {
API_URL: 'https://mock.com/api'
};
@ManuViola77
ManuViola77 / styles.js
Created March 10, 2020 20:13
styles.js
import {StyleSheet} from 'react-native';
const differentFont = "Dan'sDisneyUI";
const styles = StyleSheet.create({
container: {
alignItems: 'center',
flex: 1,
justifyContent: 'space-around',
},