Unsubscribe (#595)

Fixes #597
This commit is contained in:
cyan317
2023-04-20 08:54:20 +01:00
committed by GitHub
parent 0bc84fefbf
commit 93e2ac529d
8 changed files with 875 additions and 80 deletions

View File

@@ -491,43 +491,3 @@ TEST_F(RPCBaseTest, SubscribeAccountsValidator)
err = spec.validate(failingInput);
ASSERT_FALSE(err);
}
TEST_F(RPCBaseTest, SubscribeBooksValidator)
{
auto const spec = RpcSpec{{"books", SubscribeBooksValidator}};
auto passingInput = json::parse(
R"({
"books": [{
"taker_pays":
{
"currency": "XRP"
},
"taker_gets":
{
"currency": "USD",
"issuer": "rhub8VRN55s94qWKDv6jmDy1pUykJzF3wq"
}
}]
})");
ASSERT_TRUE(spec.validate(passingInput));
auto failingInput = json::parse(R"({ "books": 256})");
auto err = spec.validate(failingInput);
ASSERT_FALSE(err);
failingInput = json::parse(R"({ "books": ["test"]})");
err = spec.validate(failingInput);
ASSERT_FALSE(err);
failingInput = json::parse(
R"({
"books": [{
"taker_pays":
{
"currency": "XRP"
}
}]
})");
err = spec.validate(failingInput);
ASSERT_FALSE(err);
}