23 lines
1.1 KiB
C++
23 lines
1.1 KiB
C++
// Route: GET /ai/xai/platform (page, no credential needed)
|
|
#include "support/Assert.hpp"
|
|
|
|
using namespace molo::example::test;
|
|
|
|
int main() {
|
|
unsetenv("XAI_API_KEY");
|
|
unsetenv("XAI_MANAGEMENT_KEY");
|
|
Fixture f;
|
|
auto res = f.client->get("/ai/xai/platform");
|
|
check(res.status == 200, "status 200");
|
|
check(contains(res.headers.get("Content-Type"), "text/html"), "html");
|
|
check(contains(res.body, "xAI Platform") && contains(res.body, "viewport"), "page and mobile viewport");
|
|
check(contains(res.body, "/embedded/ai_xai_platform.js"), "script wired");
|
|
check(contains(res.body, "<select id=\"xp-route\""), "route picker is a dropdown, not a button group");
|
|
check(f.client->post("/ai/xai/platform", "{}", "application/json").status == 405, "post is 405");
|
|
auto js = f.client->get("/embedded/ai_xai_platform.js");
|
|
check(js.status == 200 && contains(js.body, "/ai/xai/platform/"), "script is served");
|
|
auto idx = f.client->get("/");
|
|
check(idx.status == 200 && contains(idx.body, "/ai/xai/platform"), "matrix lists the page");
|
|
return finish("ai/xai/platform");
|
|
}
|