Skip to content

Commit

Permalink
converted JavaScriptModuleRegistryTest java file to kotlin (#38143)
Browse files Browse the repository at this point in the history
Summary:
Helping in [Kotlin-ify React Native tests](#37708), Converted [react/bridge/JavaScriptModuleRegistryTest.java](https://github.com/facebook/react-native/tree/main/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridge/JavaScriptModuleRegistryTest.java) to kotlin file

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[INTERNAL] [CHANGED] - `JavaScriptModuleRegistryTest.java` file migrated from java to kotlin

Pull Request resolved: #38143

Test Plan:
Tests should pass
```
./gradlew :packages:react-native:ReactAndroid:test
```

Reviewed By: NickGerleman

Differential Revision: D47164993

Pulled By: mdvacca

fbshipit-source-id: 6aee2bcb2766fc2e6d68f4df272aaafb9c65bdcb
  • Loading branch information
stanwolverine authored and facebook-github-bot committed Jul 3, 2023
1 parent b10f0b8 commit f90829f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 35 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

package com.facebook.react.bridge

import org.junit.Assert
import org.junit.Test

/** Tests for [JavaScriptModuleRegistry] */
class JavaScriptModuleRegistryTest {
private interface TestJavaScriptModule : JavaScriptModule {
fun doSomething()
}

private interface `OuterClass$NestedInnerClass` : JavaScriptModule {
fun doSomething()
}

@Test
fun testGetJSModuleName() {
val name = JavaScriptModuleRegistry.getJSModuleName(TestJavaScriptModule::class.java)
Assert.assertEquals("TestJavaScriptModule", name)
}

@Test
fun testGetJSModuleName_stripOuterClass() {
val name = JavaScriptModuleRegistry.getJSModuleName(`OuterClass$NestedInnerClass`::class.java)
Assert.assertEquals("NestedInnerClass", name)
}
}

0 comments on commit f90829f

Please sign in to comment.