Skip to content

Commit 70ae130

Browse files
committed
add unit test
1 parent d7a2bd5 commit 70ae130

File tree

1 file changed

+23
-0
lines changed
  • substrata-kotlin/src/androidTest/java/com/segment/analytics/substrata/kotlin

1 file changed

+23
-0
lines changed

substrata-kotlin/src/androidTest/java/com/segment/analytics/substrata/kotlin/EngineTests.kt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,29 @@ class EngineTests {
599599
assertNotNull(exception)
600600
}
601601

602+
@Test
603+
fun testIncompatibleParameters() {
604+
class MyJSClass {
605+
fun test(a: String?, b: String, c: JSValue, d: Int): Int {
606+
return d
607+
}
608+
}
609+
scope.sync {
610+
export( "MyJSClass", MyJSClass::class)
611+
var res: Int = evaluate("""
612+
let o = MyJSClass()
613+
o.test(null, undefined, {}, 1234)
614+
""") as Int
615+
assertEquals(1234, res)
616+
617+
res = evaluate("""
618+
o.test("a", "b", {}, 5678)
619+
""") as Int
620+
assertEquals(5678, res)
621+
}
622+
assertNotNull(exception)
623+
}
624+
602625
@Test
603626
fun testAwait() {
604627
val ret = scope.await {

0 commit comments

Comments
 (0)