Skip to content

Commit dccbfbb

Browse files
committed
Fix JavaScript target errors
`Name contains illegal chars that cannot appear in JavaScript identifier.` I thought about using the `@JsName` annotation here to just rename the test method in JavaScript, but that potentially duplicated the test name. Easier to just replace spaced with underscores, and then remove the backtick escapes.
1 parent efc6d0c commit dccbfbb

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

runtime/src/commonTest/kotlin/com/collectiveidea/ktor/IsJsonHelpersKtTest.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ import kotlin.test.assertTrue
99

1010
class IsJsonHelpersKtTest {
1111
@Test
12-
fun `ContentType isJson returns true when missing charset`() {
12+
fun contentType_isJson_returns_true_when_missing_charset() {
1313
val contentType = ContentType.Application.Json
1414
assertTrue(contentType.isJson())
1515
}
1616

1717
@Test
18-
fun `ContentType isJson returns true when charset present`() {
18+
fun contentType_isJson_returns_true_when_charset_present() {
1919
val contentType = ContentType.Application.Json.withCharset(Charsets.UTF_8)
2020
assertTrue(contentType.isJson())
2121
}
2222

2323
@Test
24-
fun `ContentType isJson returns false when not explicitly json`() {
24+
fun contentType_isJson_returns_false_when_not_explicitly_json() {
2525
val contentType = ContentType.Application.Any
2626
assertFalse(contentType.isJson())
2727
}

runtime/src/commonTest/kotlin/com/collectiveidea/twirp/ErrorResponseTest.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class ErrorResponseTest {
1414
}
1515

1616
@Test
17-
fun `decodes properly with missing meta`() {
17+
fun decodes_properly_with_missing_meta() {
1818
val error = decode("""{"code":"not_found","msg":"not found"}""")
1919

2020
assertEquals(ErrorCode.NotFound, error.code)
@@ -23,15 +23,15 @@ class ErrorResponseTest {
2323
}
2424

2525
@Test
26-
fun `decodes unrecognized enum as enum`() {
26+
fun decodes_unrecognized_enum_as_enum() {
2727
val error = decode("""{"code":"this_is_not_available","msg":"new error code"}""")
2828

2929
assertEquals(ErrorCode.Unknown, error.code)
3030
assertEquals("new error code", error.msg)
3131
}
3232

3333
@Test
34-
fun `decodes meta with arbitrary values`() {
34+
fun decodes_meta_with_arbitrary_values() {
3535
val error = decode(
3636
"""{
3737
"code":"canceled",

0 commit comments

Comments
 (0)