Files
GaCyGO-Android/app/src/test/java/com/gacy/android/UnstuckResponseTest.kt
T

17 lines
766 B
Kotlin
Raw Normal View History

2026-11-02 02:39:37 +07:00
package com.gacy.android
import com.gacy.android.data.parseUnstuckResponse
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
class UnstuckResponseTest {
@Test fun confirmsOnlyQueuedRequestsWithAnId() {
assertTrue(parseUnstuckResponse("""{"state":"queued","request_id":"abc"}""").success)
assertFalse(parseUnstuckResponse("""{"retcode":0,"message":"OK"}""").success)
assertFalse(parseUnstuckResponse("""{"state":"queued"}""").success)
assertFalse(parseUnstuckResponse("""{"state":"queued","request_id":null}""").success)
assertFalse(parseUnstuckResponse("""{"state":"failed","request_id":"abc"}""").success)
assertFalse(parseUnstuckResponse("not json").success)
}
}