5 changed files with 63 additions and 32 deletions
@ -0,0 +1,25 @@
|
||||
#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"); |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue