Return error when limit<=0 (#804)

Fix #806
This commit is contained in:
cyan317
2023-08-02 15:34:42 +01:00
committed by GitHub
parent 1804e3e9c0
commit c90bc15959
45 changed files with 832 additions and 562 deletions

View File

@@ -495,7 +495,7 @@ TEST_P(UnsubscribeParameterTest, InvalidParams)
runSpawn([&, this](auto yield) {
auto const handler = AnyHandler{TestUnsubscribeHandler{mockBackendPtr, mockSubscriptionManagerPtr}};
auto const req = json::parse(testBundle.testJson);
auto const output = handler.process(req, Context{std::ref(yield)});
auto const output = handler.process(req, Context{yield});
ASSERT_FALSE(output);
auto const err = RPC::makeError(output.error());
EXPECT_EQ(err.at("error").as_string(), testBundle.expectedError);
@@ -507,7 +507,7 @@ TEST_F(RPCUnsubscribeTest, EmptyResponse)
{
runSpawn([&, this](auto yield) {
auto const handler = AnyHandler{TestUnsubscribeHandler{mockBackendPtr, mockSubscriptionManagerPtr}};
auto const output = handler.process(json::parse(R"({})"), Context{std::ref(yield), session_});
auto const output = handler.process(json::parse(R"({})"), Context{yield, session_});
ASSERT_TRUE(output);
EXPECT_TRUE(output->as_object().empty());
});
@@ -531,7 +531,7 @@ TEST_F(RPCUnsubscribeTest, Streams)
runSpawn([&, this](auto yield) {
auto const handler = AnyHandler{TestUnsubscribeHandler{mockBackendPtr, mockSubscriptionManagerPtr}};
auto const output = handler.process(input, Context{std::ref(yield), session_});
auto const output = handler.process(input, Context{yield, session_});
ASSERT_TRUE(output);
EXPECT_TRUE(output->as_object().empty());
});
@@ -553,7 +553,7 @@ TEST_F(RPCUnsubscribeTest, Accounts)
runSpawn([&, this](auto yield) {
auto const handler = AnyHandler{TestUnsubscribeHandler{mockBackendPtr, mockSubscriptionManagerPtr}};
auto const output = handler.process(input, Context{std::ref(yield), session_});
auto const output = handler.process(input, Context{yield, session_});
ASSERT_TRUE(output);
EXPECT_TRUE(output->as_object().empty());
});
@@ -577,7 +577,7 @@ TEST_F(RPCUnsubscribeTest, AccountsProposed)
runSpawn([&, this](auto yield) {
auto const handler = AnyHandler{TestUnsubscribeHandler{mockBackendPtr, mockSubscriptionManagerPtr}};
auto const output = handler.process(input, Context{std::ref(yield), session_});
auto const output = handler.process(input, Context{yield, session_});
ASSERT_TRUE(output);
EXPECT_TRUE(output->as_object().empty());
});
@@ -612,7 +612,7 @@ TEST_F(RPCUnsubscribeTest, Books)
runSpawn([&, this](auto yield) {
auto const handler = AnyHandler{TestUnsubscribeHandler{mockBackendPtr, mockSubscriptionManagerPtr}};
auto const output = handler.process(input, Context{std::ref(yield), session_});
auto const output = handler.process(input, Context{yield, session_});
ASSERT_TRUE(output);
EXPECT_TRUE(output->as_object().empty());
});
@@ -645,7 +645,7 @@ TEST_F(RPCUnsubscribeTest, SingleBooks)
runSpawn([&, this](auto yield) {
auto const handler = AnyHandler{TestUnsubscribeHandler{mockBackendPtr, mockSubscriptionManagerPtr}};
auto const output = handler.process(input, Context{std::ref(yield), session_});
auto const output = handler.process(input, Context{yield, session_});
ASSERT_TRUE(output);
EXPECT_TRUE(output->as_object().empty());
});