Fix PR 3 review findings [skip ci]
This commit is contained in:
1 parent
590178e41a
commit
454620f21e
21 files changed
+522
-160
No files matched your search
@@ -81,7 +81,7 @@ async fn leveling_and_quests_progression() {
|
||||
"playtime_secs": 60
|
||||
}
|
||||
],
|
||||
"events": []
|
||||
"events": [{"uuid": &alex_uuid, "kind": "action", "detail": "block_broken:DIAMOND_ORE@minecraft:overworld +4"}]
|
||||
})),
|
||||
)
|
||||
.await;
|
||||
@@ -92,6 +92,12 @@ async fn leveling_and_quests_progression() {
|
||||
assert_eq!(s, StatusCode::OK, "{lvl_after}");
|
||||
let current_xp = lvl_after["global_xp"].as_i64().unwrap();
|
||||
assert!(current_xp > 0, "Alex should have earned XP");
|
||||
let (s, quests_after) = t.call("GET", "/api/v1/quests/me", Some(&alex_token), None).await;
|
||||
assert_eq!(s, StatusCode::OK);
|
||||
let progress = |id: &str| quests_after.as_array().unwrap().iter()
|
||||
.find(|q| q["quest"]["id"] == id).unwrap()["progress"].as_i64().unwrap();
|
||||
assert_eq!(progress("q_d_mine_diamond"), 4);
|
||||
assert_eq!(progress("q_d_mine_coal"), 0);
|
||||
|
||||
// 5. Game Server sync with leveling DISABLED (server host turned it off in config)
|
||||
let (s, sync_off) = t
|
||||
@@ -137,6 +143,9 @@ async fn guilds_and_land_claims() {
|
||||
let admin = t.login("admin", "supersecret").await;
|
||||
let (alex_token, _, alex_uuid, steve_uuid) = setup_users(&t).await;
|
||||
let (server_id, server_token) = create_test_server(&t, &admin).await;
|
||||
let (status, updated) = t.call("PUT", &format!("/api/admin/servers/{server_id}"), Some(&admin),
|
||||
Some(json!({"name": "Survival Hub", "instance_id": "smp-pack"}))).await;
|
||||
assert_eq!(status, StatusCode::OK, "{updated}");
|
||||
|
||||
// 1. Alex founds a guild
|
||||
let (s, guild) = t
|
||||
@@ -247,6 +256,14 @@ async fn guilds_and_land_claims() {
|
||||
.await;
|
||||
assert_eq!(s, StatusCode::OK);
|
||||
assert_eq!(check_unclaimed["allowed"], true);
|
||||
|
||||
// The in-game command uses the server unclaim route rather than DELETE.
|
||||
let (s, _) = t.call("POST", "/api/server/v1/guilds/claim", Some(&server_token),
|
||||
Some(json!({"uuid": &alex_uuid, "dimension": "minecraft:overworld", "chunk_x": 3, "chunk_z": 7}))).await;
|
||||
assert_eq!(s, StatusCode::OK);
|
||||
let (s, response) = t.call("POST", "/api/server/v1/guilds/unclaim", Some(&server_token),
|
||||
Some(json!({"uuid": &alex_uuid, "dimension": "minecraft:overworld", "chunk_x": 3, "chunk_z": 7}))).await;
|
||||
assert_eq!(s, StatusCode::OK, "{response}");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@@ -332,10 +349,17 @@ async fn social_friends_dms_and_profiles() {
|
||||
let (s, like_res) = t.call("POST", &format!("/api/v1/social/posts/{post_id}/like"), Some(&steve_token), None).await;
|
||||
assert_eq!(s, StatusCode::OK, "{like_res}");
|
||||
assert_eq!(like_res["ok"], true);
|
||||
let (s, repeat_like) = t.call("POST", &format!("/api/v1/social/posts/{post_id}/like"), Some(&steve_token), None).await;
|
||||
assert_eq!(s, StatusCode::OK);
|
||||
assert_eq!(repeat_like["liked"], false);
|
||||
|
||||
// Steve views Alex's full profile
|
||||
let (s, profile) = t.call("GET", &format!("/api/v1/social/profile/{alex_uuid}"), Some(&steve_token), None).await;
|
||||
assert_eq!(s, StatusCode::OK, "{profile}");
|
||||
assert_eq!(profile["bio"], "Redstone expert and dragon hunter.");
|
||||
assert_eq!(profile["posts"][0]["likes_count"], 1);
|
||||
assert_eq!(profile["posts"][0]["liked_by_me"], true);
|
||||
let (s, author_profile) = t.call("GET", &format!("/api/v1/social/profile/{alex_uuid}"), Some(&alex_token), None).await;
|
||||
assert_eq!(s, StatusCode::OK);
|
||||
assert_eq!(author_profile["posts"][0]["liked_by_me"], false);
|
||||
}
|
||||
Reference in new issue
Block a user