Files
moloapp/tests/example/orm/users_test.cpp
T
retoor 3c4334cec9 feat: implement MoloApp plans 01-15 with integration
Full C++23 framework tree: runtime, observability, security,
data, app, realtime, supervisor, clients, CLI, example plus
enterprise tenancy, audit, operability, governance,
supplychain. Postgres via docker compose for tests.
2026-10-23 18:20:04 +02:00

25 lines
1.0 KiB
C++

// Route: /orm/users (dual backends, auto-sync self-healing)
#include "support/Assert.hpp"
using namespace molo::example::test;
int main() {
Fixture f;
auto first = f.client->get("/orm/users?backend=sqlite");
check(first.status == 200, "sqlite status 200");
check(contains(first.body, "\"healed\":true"), "table auto-created");
auto insert = f.client->post("/orm/users?backend=sqlite",
"{\"name\":\"ada\"}", "application/json");
check(insert.status == 201, "insert status 201");
auto widen = f.client->post("/orm/users?backend=sqlite",
"{\"name\":\"g\",\"email\":\"g@x.io\"}",
"application/json");
check(contains(widen.body, "auto-added column email"),
"new column self-healed");
auto pg = f.client->get("/orm/users?backend=postgres");
check(contains(pg.body, "\"backend\":\"postgres\""),
"postgres backend selected");
check(!f.services.sqlite->tables().empty(), "side effect: table exists");
return finish("orm/users");
}