mirror of
https://github.com/logos-storage/nim-nitro.git
synced 2026-01-03 14:13:09 +00:00
20 lines
526 B
Nim
20 lines
526 B
Nim
import ./basics
|
|
|
|
suite "json serialization":
|
|
|
|
let payment = SignedState.example()
|
|
|
|
test "serializes signed states to json":
|
|
check payment.toJson.len > 0
|
|
|
|
test "deserializes signed state":
|
|
check SignedState.fromJson(payment.toJson) == payment.some
|
|
|
|
test "returns none when deserializing invalid json":
|
|
let invalid = "{"
|
|
check SignedState.fromJson(invalid).isNone
|
|
|
|
test "returns none when json cannot be converted to signed state":
|
|
let invalid = "{}"
|
|
check SignedState.fromJson(invalid).isNone
|