Browse Source

Implemented test for public constructor (#3153)

andresesfm 6 years ago
parent
commit
935557a2ef

+ 27
- 0
lib/android/app/src/test/java/com/reactnativenavigation/react/ReactGatewayTest.java View File

@@ -0,0 +1,27 @@
1
+package com.reactnativenavigation.react;
2
+
3
+import com.reactnativenavigation.BaseTest;
4
+
5
+import org.junit.Test;
6
+import org.robolectric.RuntimeEnvironment;
7
+
8
+public class ReactGatewayTest extends BaseTest {
9
+
10
+    @Override
11
+    public void beforeEach() {
12
+        super.beforeEach();
13
+    }
14
+
15
+    /**
16
+     * This is to make sure that the constructor that takes a host remains public as per
17
+     * reasons described on this ticket:
18
+     * https://github.com/wix/react-native-navigation/issues/3145
19
+     * Exception comes from SoLoader.init so we simply ignore it as it's not related to this test
20
+     */
21
+    @Test(expected = RuntimeException.class)
22
+    public void testPublicConstructor() {
23
+        NavigationReactNativeHost host = new NavigationReactNativeHost(RuntimeEnvironment.application, false, null);
24
+        new ReactGateway(RuntimeEnvironment.application, false, host);
25
+    }
26
+
27
+}