feat: update
This commit is contained in:
@@ -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():
|
||||
|
||||
@@ -170,7 +170,7 @@ func _store_password(password: String) -> String:
|
||||
# Should hash, not store plaintext
|
||||
return password.sha256_text()
|
||||
|
||||
func _attempt_auth(user: String, pass: String) -> bool:
|
||||
func _attempt_auth(user: String, password: String) -> bool:
|
||||
return false # Should fail with wrong credentials
|
||||
|
||||
func _get_logged_content() -> String:
|
||||
|
||||
@@ -65,12 +65,12 @@ func test_central_error_handling():
|
||||
# Test 9: Service ownership is clear
|
||||
func test_service_ownership_clear():
|
||||
var owners = _get_service_owners()
|
||||
assert_is_not_empty(owners, "Service owners should be defined")
|
||||
assert_false(owners.is_empty(), "Service owners should be defined")
|
||||
|
||||
# Test 10: Facade provides unified interface
|
||||
func test_facade_unified_interface():
|
||||
var methods = _get_facade_methods()
|
||||
assert_is_not_empty(methods, "Facade should provide methods")
|
||||
assert_false(methods.is_empty(), "Facade should provide methods")
|
||||
|
||||
# Helper functions
|
||||
func _facade_has_service(service_name: String) -> bool:
|
||||
|
||||
@@ -61,7 +61,7 @@ func test_errors_centrally_handled():
|
||||
# Test 9: Facade provides unified interface
|
||||
func test_unified_interface():
|
||||
var methods = _get_facade_methods()
|
||||
assert_is_not_empty(methods, "Facade should provide unified interface")
|
||||
assert_false(methods.is_empty(), "Facade should provide unified interface")
|
||||
|
||||
# Test 10: No direct service access
|
||||
func test_no_direct_service_access():
|
||||
|
||||
@@ -20,7 +20,7 @@ func after_each():
|
||||
# Test 1: Debug gates are properly configured
|
||||
func test_debug_gates_configured():
|
||||
var debug_gates = _get_debug_gates()
|
||||
assert_is_not_empty(debug_gates, "Debug gates should be configured")
|
||||
assert_false(debug_gates.is_empty(), "Debug gates should be configured")
|
||||
|
||||
# Test 2: No hardcoded debug flags in release
|
||||
func test_no_hardcoded_debug_flags():
|
||||
@@ -38,7 +38,7 @@ func test_telemetry_can_be_disabled():
|
||||
# Test 4: Dead code paths are removed
|
||||
func test_dead_code_paths_removed():
|
||||
var dead_paths = _find_dead_code_paths()
|
||||
assert_is_empty(dead_paths, "Should have no dead code paths")
|
||||
assert_true(dead_paths.is_empty(), "Should have no dead code paths")
|
||||
|
||||
# Test 5: Debug output is conditional
|
||||
func test_debug_output_conditional():
|
||||
|
||||
@@ -92,7 +92,7 @@ func test_build_artifact_extensions():
|
||||
|
||||
# Test 9: Deployment config is not empty
|
||||
func test_deployment_config_not_empty():
|
||||
assert_is_not_empty(deployment_config, "Deployment config should not be empty")
|
||||
assert_false(deployment_config.is_empty(), "Deployment config should not be empty")
|
||||
|
||||
# Test 10: All platforms have unique package names or formats
|
||||
func test_platform_uniqueness():
|
||||
|
||||
@@ -37,7 +37,7 @@ func test_guest_profile_created():
|
||||
# Test 2: Guest progress is tracked
|
||||
func test_guest_progress_tracked():
|
||||
var progress = guest_profile.get("progress", {})
|
||||
assert_is_not_empty(progress, "Guest progress should be tracked")
|
||||
assert_false(progress.is_empty(), "Guest progress should be tracked")
|
||||
|
||||
# Test 3: Guest can be linked to persistent identity
|
||||
func test_guest_can_link_to_identity():
|
||||
|
||||
@@ -73,17 +73,17 @@ func test_option_values_match_schema():
|
||||
var expected_type = schema[option]["type"]
|
||||
|
||||
if expected_type == "bool":
|
||||
assert_is(value, bool, "Option '%s' should be bool" % option)
|
||||
assert_true(value is bool, "Option '%s' should be bool" % option)
|
||||
|
||||
# Test 6: Game modes are defined
|
||||
func test_game_modes_defined():
|
||||
var modes = mode_config.get("game_modes", [])
|
||||
assert_is_not_empty(modes, "Game modes should be defined")
|
||||
assert_false(modes.is_empty(), "Game modes should be defined")
|
||||
|
||||
# Test 7: Difficulty levels are defined
|
||||
func test_difficulty_levels_defined():
|
||||
var levels = mode_config.get("difficulty_levels", [])
|
||||
assert_is_not_empty(levels, "Difficulty levels should be defined")
|
||||
assert_false(levels.is_empty(), "Difficulty levels should be defined")
|
||||
|
||||
# Test 8: No inconsistent option values
|
||||
func test_no_inconsistent_values():
|
||||
@@ -94,7 +94,7 @@ func test_no_inconsistent_values():
|
||||
var value = options[option]
|
||||
var default = schema[option]["default"]
|
||||
# Value should be same type as default
|
||||
assert_is(value, typeof(default), "Option '%s' type mismatch" % option)
|
||||
assert_eq(typeof(value), typeof(default), "Option '%s' type mismatch" % option)
|
||||
|
||||
# Test 9: Config can be validated against schema
|
||||
func test_config_validates_against_schema():
|
||||
|
||||
@@ -39,7 +39,7 @@ func test_app_id_configured():
|
||||
# Test 2: Depots configured for each platform
|
||||
func test_depots_configured():
|
||||
var depots = steam_config.get("depots", {})
|
||||
assert_is_not_empty(depots, "Depots should be configured")
|
||||
assert_false(depots.is_empty(), "Depots should be configured")
|
||||
|
||||
# Test 3: Windows depot exists
|
||||
func test_windows_depot_exists():
|
||||
@@ -59,7 +59,7 @@ func test_linux_depot_exists():
|
||||
# Test 6: Branches defined
|
||||
func test_branches_defined():
|
||||
var branches = steam_config.get("branches", {})
|
||||
assert_is_not_empty(branches, "Branches should be defined")
|
||||
assert_false(branches.is_empty(), "Branches should be defined")
|
||||
|
||||
# Test 7: Main branch exists
|
||||
func test_main_branch_exists():
|
||||
|
||||
@@ -65,7 +65,7 @@ func test_desync_triggers_correction():
|
||||
var server_pos = Vector3(50, 50, 50)
|
||||
var correction = _calculate_position_correction(client_pos, server_pos)
|
||||
|
||||
assert_is_not_empty(correction, "Desync should trigger correction")
|
||||
assert_false(correction.is_empty(), "Desync should trigger correction")
|
||||
|
||||
# Test 8: Multiple axis deviation is calculated correctly
|
||||
func test_multi_axis_deviation():
|
||||
|
||||
Reference in New Issue
Block a user