feat: enhance validation and serialization with fiscal code checks and JSON schema support
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "common/GeoJson.h"
|
||||
#include "common/Crypto.h"
|
||||
#include "common/Validation.h"
|
||||
#include "repositories/Sql.h"
|
||||
|
||||
#include <future>
|
||||
|
||||
@@ -53,7 +54,28 @@ DROGON_TEST(ValidationRejectsMalformedIdentity)
|
||||
CHECK(visione::validation::isValidEmail("[email protected]"));
|
||||
CHECK(!visione::validation::isValidEmail("not-an-email"));
|
||||
CHECK(visione::validation::isValidFiscalCode("RSSMRA80A01H501U"));
|
||||
CHECK(visione::validation::isValidFiscalCode("VSSGNR94M08A662P"));
|
||||
CHECK(!visione::validation::isValidFiscalCode("short"));
|
||||
CHECK(!visione::validation::isValidFiscalCode("VSSGNR94M08A662A"));
|
||||
}
|
||||
|
||||
DROGON_TEST(SqlScalarSerializationKeepsTypes)
|
||||
{
|
||||
const auto json = []() {
|
||||
Json::Value value(Json::objectValue);
|
||||
value["id"] = Json::UInt64(7);
|
||||
value["banned"] = false;
|
||||
value["must_change_password"] = true;
|
||||
value["points"] = Json::Int64(42);
|
||||
value["phone"] = "380 6180216";
|
||||
return value;
|
||||
}();
|
||||
|
||||
CHECK(json["id"].isUInt64());
|
||||
CHECK(json["banned"].isBool());
|
||||
CHECK(json["must_change_password"].isBool());
|
||||
CHECK(json["points"].isInt64());
|
||||
CHECK(json["phone"].isString());
|
||||
}
|
||||
|
||||
DROGON_TEST(GeoJsonMatchesPointInsidePolygon)
|
||||
|
||||
Reference in New Issue
Block a user