//// `/debug/index` returns aggregate index counts as JSON. It is public (no //// gate): row counts and a replay cursor carry no sensitive data. This //// checks the wire shape; the underlying store counts are covered by each //// store's own tests. import crate_server/handlers/debug_index import gleam/http import gleam/string import support import wisp/simulate fn ctx() { let cfg = support.stub_config_with( support.unreachable_client(), "https://resolver.test", "http://localhost:8080", ) support.stub_context(cfg) } pub fn returns_counts_as_json_test() { let req = simulate.request(http.Get, "/debug/index") let resp = debug_index.status(req, ctx()) assert resp.status == 200 let body = simulate.read_body(resp) assert string.contains(body, "\"known_users\":0") assert string.contains(body, "\"shelf_entries\":0") assert string.contains(body, "\"shelf_index_seen\":0") assert string.contains(body, "\"catalog_releases\":0") assert string.contains(body, "\"catalog_edits\":0") assert string.contains(body, "\"jetstream_cursor\":null") }