mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-04 06:53:12 +00:00
* WakuNode init without WakuNodeConf * WakuNode start without WakuNodeConf * setupNat adjustments for making common version * Move setupNat to common.nim to be used for v1 and v2
31 lines
806 B
Nim
31 lines
806 B
Nim
{.used.}
|
|
|
|
import
|
|
std/unittest,
|
|
chronicles, chronos, stew/shims/net as stewNet, stew/byteutils,
|
|
libp2p/crypto/crypto,
|
|
libp2p/crypto/secp,
|
|
eth/keys,
|
|
../../waku/node/v2/[wakunode2, waku_types],
|
|
../test_helpers
|
|
|
|
procSuite "WakuNode":
|
|
asyncTest "Message published with content filter is retrievable":
|
|
let
|
|
rng = keys.newRng()
|
|
nodeKey = crypto.PrivateKey.random(Secp256k1, rng[])[]
|
|
node = WakuNode.init(nodeKey, ValidIpAddress.init("0.0.0.0"),
|
|
Port(60000))
|
|
|
|
await node.start()
|
|
|
|
let
|
|
topic = "foobar"
|
|
message = ("hello world").toBytes
|
|
node.publish(topic, ContentFilter(contentTopic: topic), message)
|
|
|
|
let response = node.query(HistoryQuery(topics: @[topic]))
|
|
check:
|
|
response.messages.len == 1
|
|
response.messages[0] == message
|