Skip to content

Commit

Permalink
test for valid chain with default sdk init
Browse files Browse the repository at this point in the history
  • Loading branch information
jonesmac committed Nov 19, 2024
1 parent 751116c commit 0c96281
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions sdk/src/androidTest/java/network/xyo/client/settings/XyoSdkTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ package network.xyo.client.settings

import android.content.Context
import androidx.test.platform.app.InstrumentationRegistry
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.runBlocking
import network.xyo.client.XyoEventPayload
import network.xyo.client.XyoPanel
import network.xyo.client.account.model.AccountInstance
import org.junit.Before
import org.junit.Test
Expand Down Expand Up @@ -58,4 +61,22 @@ class XyoSdkTest {
assertInstanceOf<AccountInstance>(account)
}
}

@OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testValidChainOnInit() {
runBlocking {
val instance = XyoSdk.getInstance(appContext)

val testAccount = instance.getAccount()
val panel = XyoPanel(appContext, testAccount, fun(_:Context): List<XyoEventPayload> {
return listOf(XyoEventPayload("test_event"))
})
val result = panel.reportAsyncQuery()
val bw = result.bw

val result2 = panel.reportAsyncQuery()
assert(result2.bw.previous_hashes.contains(bw._hash))
}
}
}

0 comments on commit 0c96281

Please sign in to comment.