Skip to content
This repository was archived by the owner on Sep 8, 2021. It is now read-only.

fix(tests): fix reanimated mock.js with patch-package #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"start": "react-native start",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"test": "jest",
"postinstall": "patch-package",
"test:watch": "jest --watch"
},
"dependencies": {
Expand Down Expand Up @@ -39,6 +40,7 @@
"eslint-plugin-prettier": "^3.1.2",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.56.0",
"patch-package": "6.2.1",
"prettier": "^1.19.1",
"react-test-renderer": "16.9.0",
"typescript": "^3.7.3"
Expand Down
24 changes: 24 additions & 0 deletions patches/react-native-reanimated+1.7.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/node_modules/react-native-reanimated/mock.js b/node_modules/react-native-reanimated/mock.js
index 43978f5..f2dee0c 100644
--- a/node_modules/react-native-reanimated/mock.js
+++ b/node_modules/react-native-reanimated/mock.js
@@ -11,7 +11,9 @@
const React = require('react');
const { View, Text, Image, Animated } = require('react-native');

-function NOOP() {}
+function NOOP() {
+ return { __value: 1}
+}

class Code extends React.Component {
render() {
@@ -109,7 +111,7 @@ module.exports = {
}
},
block: (a) => a[a.length - 1],
- call: (a, b) => b(a),
+ call: (a, b) => {},
debug: NOOP,
onChange: NOOP,
startClock: NOOP,
286 changes: 286 additions & 0 deletions src/__tests__/__snapshots__/Drawer.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,286 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`DrawerNavigator should render properly 1`] = `
<View
collapsable={true}
pointerEvents="box-none"
style={
Object {
"flex": 1,
}
}
>
<View
collapsable={false}
onGestureHandlerEvent={
Object {
"__value": 1,
}
}
onGestureHandlerStateChange={
Object {
"__value": 1,
}
}
style={
Object {
"flex": 1,
"overflow": "hidden",
}
}
>
<View
importantForAccessibility="yes"
style={
Array [
Object {
"flex": 1,
},
Object {
"transform": Array [
Object {
"translateX": 0,
},
],
},
undefined,
]
}
>
<View
style={
Object {
"flex": 1,
}
}
>
<View
collapsable={false}
pointerEvents="auto"
removeClippedSubviews={false}
style={
Array [
Object {
"flex": 1,
"overflow": "hidden",
},
Array [
Object {
"bottom": 0,
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
},
Object {
"opacity": 1,
},
],
]
}
>
<View
style={
Object {
"flex": 1,
}
}
>
<View>
<Text>
Test Screen
</Text>
</View>
</View>
</View>
</View>
<View
collapsable={false}
onGestureHandlerStateChange={
Object {
"__value": 1,
}
}
style={
Array [
Object {
"backgroundColor": "rgba(0, 0, 0, 0.5)",
"bottom": 0,
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
},
Object {
"opacity": Object {
"__value": 1,
},
"zIndex": -1,
},
Object {
"backgroundColor": "rgba(0, 0, 0, 0.5)",
},
]
}
/>
</View>
<View
accessibilityViewIsModal={false}
removeClippedSubviews={false}
style={
Array [
Object {
"backgroundColor": "white",
"bottom": 0,
"maxWidth": "100%",
"position": "absolute",
"top": 0,
"width": "80%",
},
Object {
"left": AnimatedValue {
" __value": NaN,
},
},
Object {
"opacity": Object {
"setValue": [Function],
},
"transform": Array [
Object {
"translateX": NaN,
},
],
"zIndex": 0,
},
Object {
"backgroundColor": "#fff",
"width": 320,
},
]
}
>
<View
style={
Array [
Object {
"flex": 1,
},
undefined,
]
}
>
<ScrollView
alwaysBounceVertical={false}
>
<View
pointerEvents="box-none"
style={
Object {
"paddingBottom": 0,
"paddingLeft": 0,
"paddingRight": 0,
"paddingTop": 20,
}
}
>
<View
style={
Array [
Object {
"paddingVertical": 4,
},
undefined,
]
}
>
<TouchableOpacity
accessibilityLabel="Home"
accessible={true}
activeOpacity={0.2}
borderless={false}
delayPressIn={0}
pressColor="rgba(0, 0, 0, .32)"
>
<View
pointerEvents="box-none"
style={
Object {
"alignItems": "center",
"backgroundColor": "rgba(0, 0, 0, .04)",
"flexDirection": "row",
"paddingBottom": 0,
"paddingLeft": 0,
"paddingRight": 0,
"paddingTop": 0,
}
}
>
<Text
style={
Array [
Object {
"fontWeight": "bold",
"margin": 16,
},
Object {
"color": "#2196f3",
},
undefined,
undefined,
]
}
>
Home
</Text>
</View>
</TouchableOpacity>
<TouchableOpacity
accessibilityLabel="Settings"
accessible={true}
activeOpacity={0.2}
borderless={false}
delayPressIn={0}
pressColor="rgba(0, 0, 0, .32)"
>
<View
pointerEvents="box-none"
style={
Object {
"alignItems": "center",
"backgroundColor": "transparent",
"flexDirection": "row",
"paddingBottom": 0,
"paddingLeft": 0,
"paddingRight": 0,
"paddingTop": 0,
}
}
>
<Text
style={
Array [
Object {
"fontWeight": "bold",
"margin": 16,
},
Object {
"color": "rgba(0, 0, 0, .87)",
},
undefined,
undefined,
]
}
>
Settings
</Text>
</View>
</TouchableOpacity>
</View>
</View>
</ScrollView>
</View>
</View>
</View>
</View>
`;
Loading