feature updates
This commit is contained in:
56
tests/unit/test_ability_system.gd
Normal file
56
tests/unit/test_ability_system.gd
Normal file
@@ -0,0 +1,56 @@
|
||||
extends GutTest
|
||||
|
||||
## Tests for the AbilitySystem and related components
|
||||
|
||||
|
||||
func test_target_selector_instantiates() -> void:
|
||||
var selector = TargetSelector.new()
|
||||
assert_not_null(selector, "TargetSelector should instantiate")
|
||||
|
||||
|
||||
func test_trigger_matcher_instantiates() -> void:
|
||||
var matcher = TriggerMatcher.new()
|
||||
assert_not_null(matcher, "TriggerMatcher should instantiate")
|
||||
|
||||
|
||||
func test_effect_resolver_instantiates() -> void:
|
||||
var resolver = EffectResolver.new()
|
||||
assert_not_null(resolver, "EffectResolver should instantiate")
|
||||
|
||||
|
||||
func test_field_effect_manager_instantiates() -> void:
|
||||
var manager = FieldEffectManager.new()
|
||||
assert_not_null(manager, "FieldEffectManager should instantiate")
|
||||
|
||||
|
||||
func test_field_effect_manager_clear() -> void:
|
||||
var manager = FieldEffectManager.new()
|
||||
manager.clear_all()
|
||||
assert_eq(manager.get_active_ability_count(), 0, "Should have no active abilities after clear")
|
||||
|
||||
|
||||
func test_target_selector_empty_spec() -> void:
|
||||
var selector = TargetSelector.new()
|
||||
var result = selector.get_valid_targets({}, null, null)
|
||||
assert_eq(result.size(), 0, "Empty spec should return empty array")
|
||||
|
||||
|
||||
func test_trigger_matcher_event_matching() -> void:
|
||||
var matcher = TriggerMatcher.new()
|
||||
|
||||
# Test direct event match
|
||||
assert_true(matcher._event_matches("ATTACKS", "ATTACKS"), "Direct match should work")
|
||||
|
||||
# Test enters field variations
|
||||
assert_true(matcher._event_matches("ENTERS_FIELD", "CARD_PLAYED"), "ENTERS_FIELD should match CARD_PLAYED")
|
||||
|
||||
# Test leaves field variations
|
||||
assert_true(matcher._event_matches("LEAVES_FIELD", "FORWARD_BROKEN"), "LEAVES_FIELD should match FORWARD_BROKEN")
|
||||
|
||||
|
||||
func test_trigger_matcher_source_matching() -> void:
|
||||
var matcher = TriggerMatcher.new()
|
||||
|
||||
# ANY should always match
|
||||
var event_data = {"card": null}
|
||||
assert_true(matcher._source_matches("ANY", event_data, null, null), "ANY source should always match")
|
||||
Reference in New Issue
Block a user