Skip to content

sherpa-onnx.rn: instrumented tests pass without testing anything (reflection, missing keys, empty assertions) #476

Closed

Description

@abretonc7s

Three defects in packages/sherpa-onnx.rn/android/src/androidTest/. All predate #468, which touches none of these lines. They matter once #475 makes the suites runnable: two would throw, and the rest pass while asserting nothing.

1. isLibraryLoaded reflection always passes

TtsIntegrationTest.kt:193 reflects isLibraryLoaded as a field. It is a companion-object var in SherpaOnnxImpl.kt:49, so only a getter exists and getDeclaredField throws NoSuchFieldException. A generic catch swallows that and the test passes unconditionally.

Correcting the reflection exposes a second bug at line 202: it checks for com.k2fsa.sherpa.onnx.Tts, which does not exist. The class is OfflineTts.

Net effect: a test named for native integration validates nothing and cannot fail.

2. ASR test reads a key the handler never returns

RealAsrFunctionalityTest.kt:251:

val duration = recognizeResult?.getInt("durationMs") ?: 0

ASRHandler never puts durationMs into its result map. On a successful file recognition this throws — so the failure only appears once the test starts working.

3. Error-handling tests assert nothing

The ASR and TTS error-handling tests contain no assertions and do not require their callbacks to complete. They pass whether or not the error path behaves correctly.

Why separate

#468 is a documentation PR. Its only test changes align config keys with what the handlers read. These three are runtime-test defects needing their own fix and verification, best done when the suites can actually run (#475).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions