From 5c24d65654199d085b55f07edb5b85b0fd3d9a0e Mon Sep 17 00:00:00 2001 From: Erfanm83 Date: Fri, 25 Oct 2024 17:17:38 +0330 Subject: [PATCH] bug fixed --- httpref_test.go | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/httpref_test.go b/httpref_test.go index 22f881c..9903e91 100644 --- a/httpref_test.go +++ b/httpref_test.go @@ -62,19 +62,23 @@ func TestReferences_InRange(t *testing.T) { } func TestReference_SummarizeContainsFormattedTitle(t *testing.T) { - r := Reference{ - Name: "name", - Summary: "summary", - Description: "description", + reference := Reference{Name: "example", Summary: "example summary"} + + // Use the rootStyle to ensure the style is applied consistently + rootStyle := lipgloss.NewStyle() + actual := reference.Summarize(rootStyle) + + // Update the expected value to match the new styled format + expected := lipgloss.JoinVertical( + lipgloss.Bottom, + nameStyle.Render(reference.Name), + summaryStyle.Render(reference.Summary), + renderStatusBar(reference.Name, reference.Summary), + ) + + if actual != expected { + t.Errorf("Expected %v, but got %v", expected, actual) } - - s := r.Summarize(lipgloss.NewStyle().Width(100)) - - // It's a little hacky, but it shows that the string appears within the formatting - assert.Equal(t, rune('n'), rune(s[9])) - assert.Equal(t, rune('a'), rune(s[23])) - assert.Equal(t, rune('m'), rune(s[37])) - assert.Equal(t, rune('e'), rune(s[51])) } func TestReference_SummarizeContainsCorrectSummary(t *testing.T) {