logos-messaging-nim/tests/v2/test_wakunode.nim
Oskar Thorén f828736e1c
Add support for WakuMessage and merge publish function (#122)
* Add WakuMessage type

* Add WakuMessage encoding and decoding

Also clean up waku_types module and imports

* Clean up waku_relay module

Imports, remove old text test, make fields and functions public, format.

* Publish WakuMessage

Also fix type mismatch in RPC

* Make publish work in examples, node and protocol

* Parse protobuf content in examples

* Update docs

* Update waku/node/v2/waku_types.nim

* Fix compilation error and disable out of date waku test

Co-authored-by: Kim De Mey <kim.demey@gmail.com>
2020-09-01 17:20:38 +02:00

30 lines
782 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 = "foo"
contentTopic = "foobar"
wakuMessage = WakuMessage(payload: ("hello world").toBytes,
contentTopic: contentTopic)
node.publish(topic, wakuMessage)
# TODO: Add actual subscribe part with receival of message