You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
823 B
25 lines
823 B
#include <Catch/catch.hpp> |
|
#include <util.hpp> |
|
|
|
SCENARIO("we want to parse a request uri with one field") { |
|
std::string request_uri = "/session?fields=id,trains"; |
|
WHEN("we parse the uri") { |
|
auto result = util::uri::parse(request_uri); |
|
THEN("the map should contain structured data based ont the uri") { |
|
REQUIRE(result.size() == 1); |
|
REQUIRE(result["fields"] == "id,trains"); |
|
} |
|
} |
|
} |
|
|
|
SCENARIO("we want to parse a request uri with more field") { |
|
std::string request_uri = "/session?fields=id,trains&sort=desc"; |
|
WHEN("we parse the uri") { |
|
auto result = util::uri::parse(request_uri); |
|
THEN("the map should contain structured data based ont the uri") { |
|
REQUIRE(result.size() == 2); |
|
REQUIRE(result["fields"] == "id,trains"); |
|
REQUIRE(result["sort"] == "desc"); |
|
} |
|
} |
|
}
|
|
|