Add launcher preferences and modular landing studio [skip ci]
This commit is contained in:
1 parent
454620f21e
commit
6deff62a3a
25 files changed
+822
-682
No files matched your search
@@ -233,6 +233,7 @@ async fn landing_page_config_and_permissions() {
|
||||
assert_eq!(v["brand_name"], "SCOPENET");
|
||||
assert_eq!(v["enabled"], true);
|
||||
assert!(v["blocks"].as_array().unwrap().len() >= 5);
|
||||
assert_eq!(v["theme"]["accent"], "#6d6af5");
|
||||
|
||||
// 2. Unauthenticated user cannot modify landing config
|
||||
let (s, _) = t.call("PUT", "/api/admin/landing", None, Some(json!({"brand_name": "Hacked"}))).await;
|
||||
@@ -243,10 +244,24 @@ async fn landing_page_config_and_permissions() {
|
||||
let mut updated = v.clone();
|
||||
updated["brand_name"] = json!("PixelCraft");
|
||||
updated["hero_title"] = json!("Welcome to PixelCraft");
|
||||
updated["theme"]["accent"] = json!("#17bebb");
|
||||
updated["blocks"].as_array_mut().unwrap().push(json!({
|
||||
"id": "b_custom_text", "type": "text", "enabled": true, "title": "Our story",
|
||||
"subtitle": "", "options": { "body": "Built by players." }
|
||||
}));
|
||||
let (s, v2) = t.call("PUT", "/api/admin/landing", Some(&admin), Some(updated)).await;
|
||||
assert_eq!(s, StatusCode::OK);
|
||||
assert_eq!(v2["brand_name"], "PixelCraft");
|
||||
assert_eq!(v2["hero_title"], "Welcome to PixelCraft");
|
||||
assert_eq!(v2["theme"]["accent"], "#17bebb");
|
||||
assert_eq!(v2["blocks"].as_array().unwrap().last().unwrap()["type"], "text");
|
||||
|
||||
// Duplicate IDs would break drag ordering and keyed public rendering.
|
||||
let mut duplicate = v2.clone();
|
||||
let first = duplicate["blocks"][0].clone();
|
||||
duplicate["blocks"].as_array_mut().unwrap().push(first);
|
||||
let (s, _) = t.call("PUT", "/api/admin/landing", Some(&admin), Some(duplicate)).await;
|
||||
assert_eq!(s, StatusCode::BAD_REQUEST);
|
||||
|
||||
// 4. Public endpoint reflects the updated config
|
||||
let (s, v3) = t.call("GET", "/api/v1/landing", None, None).await;
|
||||
|
||||
Reference in new issue
Block a user