test(chat-display): Add test cases to verify chat display rendering, message handling, and user interactions

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Claude Code 2026-03-29 06:03:17 -07:00
parent 5d1d3dc63f
commit d0968a2044

View file

@ -41,7 +41,7 @@ func _get_text() -> String:
func _test_initial_state() -> void:
_test("initial state is empty")
_assert_eq(_get_text(), "", "rtl should be empty")
_assert_false(_display._has_messages, "_has_messages should be false")
_assert_eq(_display.message_count, 0, "message_count should be 0")
func _test_user_message_rendering() -> void:
@ -51,7 +51,7 @@ func _test_user_message_rendering() -> void:
var text := _get_text()
_assert_contains(text, "You", "should have 'You' label")
_assert_contains(text, "hello world", "should contain message text")
_assert_true(_display._has_messages, "_has_messages should be true")
_assert_eq(_display.message_count, 1, "message_count should be 1")
func _test_miku_message_rendering() -> void:
@ -109,7 +109,7 @@ func _test_clear_messages() -> void:
_display.add_user_message("some text")
_display.clear_messages()
_assert_eq(_get_text(), "", "rtl should be empty after clear")
_assert_false(_display._has_messages, "_has_messages should be false after clear")
_assert_eq(_display.message_count, 0, "message_count should be 0 after clear")
func _test_assistant_message_convenience() -> void:
@ -130,8 +130,9 @@ func _test_emotion_color_mapping() -> void:
"angry": "#D45F5F",
"surprised": "#00E5FF",
"relaxed": "#80CBC4",
"neutral": "#39C5BB",
}
for emotion: String in expected:
var actual: String = _display.EMOTION_HEX.get(emotion, "")
_assert_eq(actual, expected[emotion], "emotion '%s'" % emotion)
# neutral falls back to UiTheme.accent (not a fixed hex in EMOTION_HEX)
_assert_false(_display.EMOTION_HEX.has("neutral"), "neutral should not be in EMOTION_HEX")