test(nests): skip JvmOpusRoundTripTest when libopus natives are unavailable

club.minnced:opus-java doesn't ship natives for darwin-aarch64, so the
sine-440 round-trip test failed on Apple Silicon dev machines and blocked
the pre-push hook. Catch the IllegalStateException from encoder/decoder
construction and use JUnit Assume to skip; Linux x86_64 CI keeps coverage.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
davotoula
2026-05-07 21:46:57 +02:00
parent 2a60a6ce5a
commit 9bf17f44af
@@ -21,6 +21,7 @@
package com.vitorpamplona.nestsclient.audio
import kotlinx.coroutines.runBlocking
import org.junit.Assume.assumeTrue
import kotlin.test.Test
/**
@@ -37,8 +38,18 @@ class JvmOpusRoundTripTest {
@Test
fun sine_440_round_trips_through_libopus() {
val capture = SineWaveAudioCapture(freqHz = 440)
val encoder = JvmOpusEncoder()
val decoder = JvmOpusDecoder()
// club.minnced:opus-java doesn't ship natives for darwin-aarch64 (Apple
// Silicon). Skip rather than fail so dev machines without a usable
// native still pass the pre-push hook; Linux x86_64 CI keeps coverage.
val encoder: JvmOpusEncoder
val decoder: JvmOpusDecoder
try {
encoder = JvmOpusEncoder()
decoder = JvmOpusDecoder()
} catch (e: IllegalStateException) {
assumeTrue("Opus natives not available: ${e.message}", false)
return
}
try {
val decoded = mutableListOf<Float>()
runBlocking {