Changeset View
Changeset View
Standalone View
Standalone View
src/tests/client/room/read-receipt-test.cpp
| Show All 11 Lines | |||||
| #include <catch2/matchers/catch_matchers_range_equals.hpp> | #include <catch2/matchers/catch_matchers_range_equals.hpp> | ||||
| #include <lager/event_loop/boost_asio.hpp> | #include <lager/event_loop/boost_asio.hpp> | ||||
| #include <asio-promise-handler.hpp> | #include <asio-promise-handler.hpp> | ||||
| #include <room/room-model.hpp> | #include <room/room-model.hpp> | ||||
| #include <sdk-model.hpp> | #include <sdk-model.hpp> | ||||
| #include <client/client.hpp> | #include <client/client.hpp> | ||||
| #include <client/actions/ephemeral.hpp> | |||||
| #include <cprjobhandler.hpp> | #include <cprjobhandler.hpp> | ||||
| #include <lagerstoreeventemitter.hpp> | #include <lagerstoreeventemitter.hpp> | ||||
| #include <testfixtures/factory.hpp> | #include <testfixtures/factory.hpp> | ||||
| #include "client-test-util.hpp" | #include "client-test-util.hpp" | ||||
| using namespace Kazv; | using namespace Kazv; | ||||
| ▲ Show 20 Lines • Show All 172 Lines • ▼ Show 20 Lines | room.postReceipt("$1") | ||||
| .then([&io](auto) { | .then([&io](auto) { | ||||
| io.stop(); | io.stop(); | ||||
| }); | }); | ||||
| io.run(); | io.run(); | ||||
| REQUIRE(postReceiptCalled == 1); | REQUIRE(postReceiptCalled == 1); | ||||
| REQUIRE(postReceiptRoomId == r.roomId); | REQUIRE(postReceiptRoomId == r.roomId); | ||||
| REQUIRE(postReceiptEventId == "$1"); | REQUIRE(postReceiptEventId == "$1"); | ||||
| } | |||||
| TEST_CASE("PostReceiptAction", "[client][room][receipt]") | |||||
| { | |||||
| auto m = makeClient(); | |||||
| auto [next, _ignore] = updateClient(m, PostReceiptAction{"!someroom:example.com", "$someevent"}); | |||||
| assert1Job(next); | |||||
| for1stJob(next, [](const BaseJob &job) { | |||||
| REQUIRE(job.jobId() == "PostReceipt"); | |||||
| REQUIRE(job.url().find("rooms/!someroom:example.com/receipt/m.read/$someevent") != std::string::npos); | |||||
| REQUIRE(json::parse(std::get<Bytes>(job.requestBody())) == json::object()); | |||||
| }); | |||||
| } | } | ||||