mirror of
https://github.com/logos-messaging/logos-delivery.git
synced 2026-06-04 13:09:32 +00:00
* bump libp2p pin to release/v2.0.0 (c43199378) * pin nimble.lock: lsquic/websock/boringssl/protobuf_serialization/npeg/jwt * add libp2p_mix dep and point libp2p/protocols/mix -> libp2p_mix * migrate rng to libp2p Rng type (prod, channels, noise, tests) * noise: take Rng, extract bearSslDrbg internally * waku_switch: TransportConfig factory; withMaxInOut; local MaxConnections * waku_relay/rendezvous/discv5/kademlia: v2.0.0 API (rng, config, ServiceDiscovery) * tests: newStandardSwitch shim; PeerId.random(rng); common.rng()/crypto.newRng() * drop libp2p/utils/semaphore (use chronos AsyncSemaphore) * add waku/compat/option_valueor shim where needed * add std/options where transitive re-export dropped
36 lines
997 B
Nim
36 lines
997 B
Nim
import std/options
|
|
{.used.}
|
|
|
|
import results, stew/byteutils, testutils/unittests, json_serialization
|
|
import waku/rest_api/endpoint/serdes, waku/rest_api/endpoint/debug/types
|
|
|
|
suite "Waku v2 REST API - Debug - serialization":
|
|
suite "DebugWakuInfo - decode":
|
|
test "optional field is not provided":
|
|
# Given
|
|
let jsonBytes = toBytes("""{ "listenAddresses":["123"] }""")
|
|
|
|
# When
|
|
let res = decodeFromJsonBytes(DebugWakuInfo, jsonBytes, requireAllFields = true)
|
|
|
|
# Then
|
|
require(res.isOk())
|
|
let value = res.get()
|
|
check:
|
|
value.listenAddresses == @["123"]
|
|
value.enrUri.isNone()
|
|
|
|
suite "DebugWakuInfo - encode":
|
|
test "optional field is none":
|
|
# Given
|
|
let data = DebugWakuInfo(listenAddresses: @["GO"], enrUri: none(string))
|
|
|
|
# When
|
|
let res = encodeIntoJsonBytes(data)
|
|
|
|
# Then
|
|
require(res.isOk())
|
|
let value = res.get()
|
|
check:
|
|
value == toBytes("""{"listenAddresses":["GO"]}""")
|