17 lines
766 B
Kotlin
17 lines
766 B
Kotlin
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)
|
||
|
|
}
|
||
|
|
}
|