Skip to content

Commit 0fa95b7

Browse files
authored
Remove deprecated OS/Arch values (#1165)
1 parent 5a90833 commit 0fa95b7

File tree

2 files changed

+11
-20
lines changed

2 files changed

+11
-20
lines changed

skiko/src/commonMain/kotlin/org/jetbrains/skiko/OsArch.kt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ enum class OS(val id: String) {
77
MacOS("macos"),
88
Ios("ios"),
99
Tvos("tvos"),
10-
11-
@Deprecated("JS is invalid host OS name. Consider using enum KotlinBackend to detect JS.")
12-
JS("js"),
1310
Unknown("unknown")
1411
;
1512

@@ -26,10 +23,6 @@ enum class OS(val id: String) {
2623
enum class Arch(val id: String) {
2724
X64("x64"),
2825
Arm64("arm64"),
29-
@Deprecated("JS is not valid Arch value")
30-
JS("js"),
31-
@Deprecated("WASM is not valid Arch value")
32-
WASM("wasm"),
3326
Unknown("unknown"),
3427
;
3528
}

skiko/src/jsTest/kotlin/org/jetbrains/skiko/HostOsTest.kt

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
1-
package org.jetbrains.skiko.tests.org.jetbrains.skiko
1+
package org.jetbrains.skiko
22

3-
import org.jetbrains.skiko.OS
4-
import org.jetbrains.skiko.detectHostOs
5-
import org.jetbrains.skiko.hostOs
63
import kotlin.test.Test
74
import kotlin.test.assertEquals
8-
import kotlin.test.assertNotEquals
95

106
class HostOsTest {
11-
@Test
12-
fun canGetHostOs() {
13-
assertNotEquals(OS.JS, hostOs)
14-
}
15-
167
@Test
178
fun canGetLinux() {
189
spoofUserAgentData("linux")
@@ -51,6 +42,13 @@ class HostOsTest {
5142
}
5243
}
5344

54-
private fun spoofUserAgentData(newValue: String) =
55-
js("""navigator.__defineGetter__('userAgentData', function () { return { platform:newValue }; });""")
56-
45+
private fun spoofUserAgentData(newValue: String) {
46+
val userAgentData = js("({})")
47+
userAgentData.platform = newValue
48+
js(
49+
"""Object.defineProperty(navigator, 'userAgentData', {
50+
configurable: true,
51+
value: userAgentData
52+
});"""
53+
)
54+
}

0 commit comments

Comments
 (0)