Changeset View
Changeset View
Standalone View
Standalone View
src/tests/client/create-room-test.cpp
| Show First 20 Lines • Show All 169 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| boost::asio::io_context io; | boost::asio::io_context io; | ||||
| AsioPromiseHandler ph{io.get_executor()}; | AsioPromiseHandler ph{io.get_executor()}; | ||||
| auto store = createTestClientStore(ph); | auto store = createTestClientStore(ph); | ||||
| WHEN("Success response") | WHEN("Success response") | ||||
| { | { | ||||
| auto succResponse = makeResponse("CreateRoom", withResponseJsonBody(json{{"room_id", "!some-room:example.com"}})); | const auto roomId = "!some-room:example.com"; | ||||
| auto succResponse = makeResponse("CreateRoom", withResponseJsonBody(json{{"room_id", roomId}})); | |||||
| store.dispatch(ProcessResponseAction{succResponse}) | store.dispatch(ProcessResponseAction{succResponse}) | ||||
| .then([&](auto stat) { | .then([&, roomId](auto stat) { | ||||
| REQUIRE(stat.success()); | REQUIRE(stat.success()); | ||||
| REQUIRE(stat.dataStr("roomId") == roomId); | |||||
| }); | }); | ||||
| } | } | ||||
| WHEN("Failed response") | WHEN("Failed response") | ||||
| { | { | ||||
| auto failResponse = makeResponse("CreateRoom", withResponseStatusCode(400) | withResponseJsonBody(json{ | auto failResponse = makeResponse("CreateRoom", withResponseStatusCode(400) | withResponseJsonBody(json{ | ||||
| {"error", "An unknown error occurred"}, | {"error", "An unknown error occurred"}, | ||||
| {"errcode", "M_UNKNOWN"}, | {"errcode", "M_UNKNOWN"}, | ||||
| })); | })); | ||||
| Show All 9 Lines | |||||