Browse Source

#161 - FIX test and also forces Portrait orientation

Jordi Coscolla 1 year ago
parent
commit
29e7efb904

+ 3 - 1
apps/wallet/App.js

@@ -1,5 +1,5 @@
1 1
 import React from 'react';
2
-import { Font } from 'expo';
2
+import { Font, ScreenOrientation } from 'expo';
3 3
 import { Provider } from 'react-redux';
4 4
 import {
5 5
   NavigationProvider,
@@ -34,6 +34,8 @@ export default class App extends React.Component {
34 34
 
35 35
     await initialiseWalletID();
36 36
 
37
+    ScreenOrientation.allow(ScreenOrientation.Orientation.PORTRAIT);
38
+
37 39
     this.setState({
38 40
       ready: true,
39 41
     });

+ 2 - 1
apps/wallet/app.json

@@ -1,6 +1,7 @@
1 1
 {
2 2
   "expo": {
3
-    "sdkVersion": "23.0.0"
3
+    "sdkVersion": "23.0.0",
4
+    "orientation": "portrait"
4 5
   },
5 6
   "privacy": "unlisted"
6 7
 }

+ 2 - 1
apps/wallet/screens/Home.js

@@ -1,7 +1,7 @@
1 1
 import React from 'react';
2 2
 import { connect } from 'react-redux';
3 3
 import { Image, Text, TextInput, View, KeyboardAvoidingView } from 'react-native';
4
-import { SecureStore } from 'expo';
4
+import { SecureStore, ScreenOrientation } from 'expo';
5 5
 import PropTypes from 'prop-types';
6 6
 import { goQRScannerIntro, goToAttributesSummary, goToPetitionSummary } from '../application/redux/actions/navigation';
7 7
 import { onStartApp } from '../application/redux/actions/petitionLink';
@@ -23,6 +23,7 @@ class Home extends React.Component {
23 23
   }
24 24
 
25 25
   componentWillMount() {
26
+    ScreenOrientation.allow(ScreenOrientation.Orientation.PORTRAIT_UP);
26 27
     this.props.initializeState().then(() => {});
27 28
   }
28 29
 

+ 9 - 0
apps/wallet/test/components/Home.test.js

@@ -30,6 +30,9 @@ describe('goToNextPage', () => {
30 30
           petitionLink: somePetitionLink,
31 31
         },
32 32
         authorization: {},
33
+        attributes: {
34
+          list: [],
35
+        },
33 36
       };
34 37
       const doAuthorizeMock = jest.fn().mockReturnValue(Promise.resolve({ pinCorrect: false }));
35 38
       const wrapper = shallow(
@@ -61,6 +64,9 @@ describe('goToNextPage', () => {
61 64
           petitionLink: undefined,
62 65
         },
63 66
         authorization: {},
67
+        attributes: {
68
+          list: [],
69
+        },
64 70
       };
65 71
       const wrapper = shallow(
66 72
         <Home />,
@@ -84,6 +90,9 @@ describe('goToNextPage', () => {
84 90
           petitionLink: somePetitionLink,
85 91
         },
86 92
         authorization: {},
93
+        attributes: {
94
+          list: [],
95
+        },
87 96
       };
88 97
       const wrapper = shallow(
89 98
         <Home />,

+ 3 - 0
apps/wallet/test/snapshot/Home.test.js

@@ -14,6 +14,9 @@ const initialState = {
14 14
     petitionLink: undefined,
15 15
   },
16 16
   authorization: {},
17
+  attributes: {
18
+    list: [],
19
+  },
17 20
 };
18 21
 
19 22
 

+ 6 - 0
apps/wallet/test/snapshot/__snapshots__/Home.test.js.snap

@@ -5,9 +5,15 @@ ShallowWrapper {
5 5
   "length": 1,
6 6
   Symbol(enzyme.__root__): [Circular],
7 7
   Symbol(enzyme.__unrendered__): <Home
8
+    attributes={
9
+      Object {
10
+        "list": Array [],
11
+      }
12
+    }
8 13
     doAuthorize={[Function]}
9 14
     goQRScannerIntro={[Function]}
10 15
     goToAttributesSummary={[Function]}
16
+    goToPetitionSummary={[Function]}
11 17
     initializeState={[Function]}
12 18
     petitionLink={undefined}
13 19
     pinCode=""