feat: update

This commit is contained in:
2026-06-11 18:28:25 +08:00
parent 8520f9db3c
commit 8a2fb36a98
65 changed files with 4407 additions and 572 deletions
+8 -8
View File
@@ -39,14 +39,14 @@ func test_admin_parses_user_json_correctly():
var json_str = JSON.stringify(test_user_data)
var parsed = JSON.parse_string(json_str)
assert_is(parsed, Dictionary, "Parsed JSON should be a Dictionary")
assert_true(parsed is Dictionary, "Parsed JSON should be a Dictionary")
assert_eq(parsed.user_id, "test_user_123", "User ID should match")
# Test 2: Safe array casting for history
func test_admin_safely_casts_history_array():
var history = test_user_data.get("history", [])
assert_is(history, Array, "History should be an Array")
assert_true(history is Array, "History should be an Array")
assert_eq(history.size(), 3, "History should have 3 entries")
# Test 3: History entries are dictionaries
@@ -54,7 +54,7 @@ func test_admin_history_entries_are_valid_dicts():
var history = test_user_data.get("history", [])
for entry in history:
assert_is(entry, Dictionary, "Each history entry should be a Dictionary")
assert_true(entry is Dictionary, "Each history entry should be a Dictionary")
assert_has(entry, "action", "History entry should have 'action' field")
assert_has(entry, "timestamp", "History entry should have 'timestamp' field")
@@ -68,10 +68,10 @@ func test_admin_handles_invalid_history_gracefully():
var history = invalid_data.get("history", [])
# Should default to empty array if not an array
if not history is Array:
if not (history is Array):
history = []
assert_is(history, Array, "History should be converted to Array")
assert_true(history is Array, "History should be converted to Array")
# Test 5: History dialog displays correct number of entries
func test_admin_history_dialog_shows_all_entries():
@@ -106,7 +106,7 @@ func test_admin_handles_missing_user_fields():
assert_eq(username, "Unknown", "Should use default for missing username")
assert_eq(level, 0, "Should use default for missing level")
assert_is(history, Array, "Should default to empty array for missing history")
assert_true(history is Array, "Should default to empty array for missing history")
# Test 8: Large history doesn't cause performance issues
func test_admin_handles_large_history():
@@ -128,7 +128,7 @@ func test_admin_history_actions_are_strings():
for entry in history:
var action = entry.get("action", "")
assert_is(action, String, "Action should be a String")
assert_true(action is String, "Action should be a String")
assert_true(action.length() > 0, "Action should not be empty")
# Test 10: Timestamps are valid numbers
@@ -137,7 +137,7 @@ func test_admin_history_timestamps_are_numbers():
for entry in history:
var timestamp = entry.get("timestamp", 0)
assert_is(timestamp, int, "Timestamp should be an integer")
assert_true(timestamp is int, "Timestamp should be an integer")
assert_true(timestamp >= 0, "Timestamp should be non-negative")
func after_all():