summaryrefslogtreecommitdiff
path: root/modules/zero-bridge-api/src/commonTest/kotlin/jp/orgflow/bridge/ZeroBridgeApiTest.kt
blob: 1a392c98d03af7b1c9f7b3cab44b9c0251e90468 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package jp.orgflow.bridge

import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
import kotlin.test.assertTrue

class ZeroBridgeApiTest {
    @Test
    fun storageEstimate() {
        val est = StorageEstimate(100L, 1000L, 10.0)
        assertEquals(900L, est.availableBytes())
    }

    @Test
    fun transportFrame() {
        val frame = HostTransportFrame("alice", "bob", byteArrayOf(1, 2, 3), "data")
        assertEquals("alice", frame.from)
        assertEquals("bob", frame.to)
        assertTrue(frame.payload.contentEquals(byteArrayOf(1, 2, 3)))
    }

    @Test
    fun bridgeException() {
        val e = BridgeException("test", RuntimeException("cause"))
        assertEquals("test", e.message)
        assertNotNull(e.cause)
    }
}