Browse Source

fixed tests, removed verbose logging

Daniel Zlotin 7 years ago
parent
commit
099ebe9c08

+ 1
- 1
lib/src/commands/OptionsProcessor.js View File

@@ -11,7 +11,7 @@ class OptionsProcessor {
11 11
       if (_.isEqual(key, 'icon') || _.endsWith(key, 'Icon') || _.endsWith(key, 'Image')) {
12 12
         navigationOptions[key] = resolveAssetSource(navigationOptions[key]);
13 13
       }
14
-      if (_.isPlainObject(value) || _.isArray(value)) {
14
+      if (_.isObject(value) || _.isArray(value)) {
15 15
         OptionsProcessor.processOptions(value);
16 16
       }
17 17
     });

+ 19
- 7
lib/src/commands/OptionsProcessor.test.js View File

@@ -1,4 +1,5 @@
1 1
 const OptionsProcessor = require('./OptionsProcessor');
2
+const NavigationOptions = require('./../params/NavigationOptions');
2 3
 
3 4
 describe('navigation options', () => {
4 5
   let navigationOptions;
@@ -69,16 +70,16 @@ describe('navigation options', () => {
69 70
   });
70 71
 
71 72
   it('any nested recursive keys ending with Color', () => {
72
-    navigationOptions.innerObj = { theKeyColor: 'red' };
73
-    navigationOptions.innerObj.innerMostObj = { anotherColor: 'yellow' };
73
+    navigationOptions.topBar = { textColor: 'red' };
74
+    navigationOptions.topBar.innerMostObj = { anotherColor: 'yellow' };
74 75
     OptionsProcessor.processOptions(navigationOptions);
75
-    expect(navigationOptions.innerObj.theKeyColor).toEqual(0xffff0000);
76
-    expect(navigationOptions.innerObj.innerMostObj.anotherColor).toEqual(0xffffff00);
76
+    expect(navigationOptions.topBar.textColor).toEqual(0xffff0000);
77
+    expect(navigationOptions.topBar.innerMostObj.anotherColor).toEqual(0xffffff00);
77 78
   });
78 79
 
79 80
   it('resolve image sources with name/ending with icon', () => {
80 81
     navigationOptions.icon = 'require("https://wix.github.io/react-native-navigation/_images/logo.png");';
81
-    navigationOptions.innerObj = {
82
+    navigationOptions.topBar = {
82 83
       myIcon: 'require("https://wix.github.io/react-native-navigation/_images/logo.png");',
83 84
       myOtherValue: 'value'
84 85
     };
@@ -88,7 +89,18 @@ describe('navigation options', () => {
88 89
     // I assign the icons to strings (what the require would generally look like)
89 90
     // and expect the value to be resovled, in this case it doesn't find anything and returns null
90 91
     expect(navigationOptions.icon).toEqual(null);
91
-    expect(navigationOptions.innerObj.myIcon).toEqual(null);
92
-    expect(navigationOptions.innerObj.myOtherValue).toEqual('value');
92
+    expect(navigationOptions.topBar.myIcon).toEqual(null);
93
+    expect(navigationOptions.topBar.myOtherValue).toEqual('value');
94
+  });
95
+
96
+  it('processes NavigationOptions jsDoc object', () => {
97
+    navigationOptions.someKeyColor = 'rgb(255, 0, 255)';
98
+    navigationOptions.topBar = { textColor: 'red' };
99
+    navigationOptions.topBar.innerMostObj = { anotherColor: 'yellow' };
100
+    const navigationOptionsObj = new NavigationOptions(navigationOptions);
101
+
102
+    OptionsProcessor.processOptions(navigationOptionsObj);
103
+
104
+    expect(navigationOptionsObj.topBar.textColor).toEqual(0xffff0000);
93 105
   });
94 106
 });

+ 1
- 1
scripts/test.e2e.ios.js View File

@@ -7,6 +7,6 @@ run();
7 7
 
8 8
 function run() {
9 9
   const conf = release ? `release` : `debug`;
10
-  exec.execSync(`detox build --configuration ios.sim.${conf} && detox test --configuration ios.sim.${conf} ${process.env.CI ? '--cleanup' : ''} --loglevel verbose`);
10
+  exec.execSync(`detox build --configuration ios.sim.${conf} && detox test --configuration ios.sim.${conf} ${process.env.CI ? '--cleanup' : ''}`);
11 11
 }
12 12