I'm building react-native app which has some native android modules in it.
In MainApplication.java,
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new VectorIconsPackage(),
new MyCustomPackage()
);
}
In my MyCustomPackage,
public class MyCustomPackage implements ReactPackage {
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
return Collections.emptyList();
}
@Override
public List<NativeModule> createNativeModules(
ReactApplicationContext reactContext) {
List<NativeModule> modules = new ArrayList<>();
modules.add(new MyCustomModule(reactContext));
return modules;
}
}
I have few other modules but this is an example. The all functions works well. Now I want to write unit test to methods which are in the MyCustomModule java class. I try to use Robolectric framework but don't know how it's working with react native. Is there any other tool for that? Can anyone give me some example or guide in writing unit test for react-native native android code?