expo-modules-test-core 0.18.2-canary-20240927-ab8a962 → 0.18.2-canary-20241008-90b13ad

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -45,7 +45,7 @@ class ModuleMockInvocationHandler<T : Any>(
45
45
  private val moduleController: ModuleController,
46
46
  private val holder: ModuleHolder<*>
47
47
  ) : InvocationHandler {
48
- override fun invoke(proxy: Any, method: Method, args: Array<out Any>?): Any? {
48
+ override fun invoke(proxy: Any, method: Method, args: Array<Any?>?): Any? {
49
49
  if (!holder.definition.asyncFunctions.containsKey(method.name) &&
50
50
  !holder.definition.syncFunctions.containsKey(method.name)
51
51
  ) {
@@ -55,10 +55,10 @@ class ModuleMockInvocationHandler<T : Any>(
55
55
  return callExportedFunction(method.name, args)
56
56
  }
57
57
 
58
- private fun callExportedFunction(methodName: String, args: Array<out Any>?): Any? {
58
+ private fun callExportedFunction(methodName: String, args: Array<Any?>?): Any? {
59
59
  if (holder.definition.syncFunctions.containsKey(methodName)) {
60
60
  // Call as a sync function
61
- return holder.callSync(methodName, convertArgs(args?.asList() ?: emptyList()))
61
+ return holder.callSync(methodName, convertArgs(args ?: emptyArray()))
62
62
  }
63
63
 
64
64
  if (holder.definition.asyncFunctions.containsKey(methodName)) {
@@ -75,9 +75,10 @@ class ModuleMockInvocationHandler<T : Any>(
75
75
  throw IllegalStateException("Module class method '$methodName' not found")
76
76
  }
77
77
 
78
- private fun nonPromiseMappingCall(methodName: String, args: Array<out Any>?): Any? {
78
+ private fun nonPromiseMappingCall(methodName: String, args: Array<Any?>?): Any? {
79
79
  val mockedPromise = PromiseMock()
80
- holder.call(methodName, convertArgs(args?.asList() ?: emptyList()), mockedPromise)
80
+
81
+ holder.call(methodName, convertArgs(args ?: emptyArray()), mockedPromise)
81
82
 
82
83
  when (mockedPromise.state) {
83
84
  PromiseState.RESOLVED -> {
@@ -109,15 +110,11 @@ class ModuleMockInvocationHandler<T : Any>(
109
110
  }
110
111
  }
111
112
 
112
- private fun promiseMappingCall(methodName: String, args: List<Any>, promise: Promise) {
113
- holder.call(methodName, convertArgs(args), promise)
114
- }
115
-
116
- private fun syncCall(methodName: String, args: Iterable<Any?>): Any? {
117
- return holder.callSync(methodName, convertArgs(args))
113
+ private fun promiseMappingCall(methodName: String, args: List<Any?>, promise: Promise) {
114
+ holder.call(methodName, convertArgs(args.toTypedArray()), promise)
118
115
  }
119
116
 
120
- private fun convertArgs(args: Iterable<Any?>): ReadableArray {
121
- return JSTypeConverter.convertToJSValue(args, TestJSContainerProvider) as ReadableArray
117
+ private fun convertArgs(args: Array<Any?>): Array<Any?> {
118
+ return (JSTypeConverter.convertToJSValue(args, TestJSContainerProvider) as ReadableArray).toArrayList().toArray()
122
119
  }
123
120
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-modules-test-core",
3
- "version": "0.18.2-canary-20240927-ab8a962",
3
+ "version": "0.18.2-canary-20241008-90b13ad",
4
4
  "main": "./app.plugin.js",
5
5
  "description": "Module providing native testing utilities for testing Expo modules",
6
6
  "keywords": [
@@ -34,5 +34,5 @@
34
34
  "xml-js": "^1.6.11",
35
35
  "yaml": "^2.3.2"
36
36
  },
37
- "gitHead": "ab8a962d2c3dddbda124a6bd88d24475831dae00"
37
+ "gitHead": "90b13ad9d0dd3469556ac776d8b74643375b1d97"
38
38
  }