105 route tests, matrix crawl, spec and README updated. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
27 lines
1019 B
C++
27 lines
1019 B
C++
// Route: GET / (every matrix link resolves; no dead rows)
|
|
#include "support/Assert.hpp"
|
|
|
|
using namespace molo::example::test;
|
|
|
|
int main() {
|
|
Fixture f;
|
|
auto index = f.client->get("/");
|
|
check(index.status == 200, "index renders");
|
|
std::size_t pos = 0, rows = 0;
|
|
const std::string marker = "<td><a href=\"";
|
|
while ((pos = index.body.find(marker, pos)) != std::string::npos) {
|
|
pos += marker.size();
|
|
std::string href = index.body.substr(pos, index.body.find('"', pos) - pos);
|
|
// The template escapes '&' in hrefs.
|
|
for (std::size_t a; (a = href.find("&")) != std::string::npos;)
|
|
href.replace(a, 5, "&");
|
|
auto res = f.client->get(href);
|
|
// /auth/me demands credentials by design; every other row must be 2xx/3xx.
|
|
bool ok = res.status < 400 || (href == "/auth/me" && res.status == 401);
|
|
check(ok, "matrix link " + href + " -> " + std::to_string(res.status));
|
|
++rows;
|
|
}
|
|
check(rows >= 37, "matrix lists at least the original 37 rows");
|
|
return finish("matrix");
|
|
}
|