Skip to content

Commit

Permalink
test(calendar): yearslong month rendering tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shawalli committed Dec 3, 2024
1 parent b335dc0 commit ad5b8f0
Show file tree
Hide file tree
Showing 5 changed files with 928 additions and 0 deletions.
31 changes: 31 additions & 0 deletions calendar/month_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package calendar

import (
"fmt"
"strconv"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -556,6 +558,35 @@ func TestMonthModel_View(t *testing.T) {
}
}

func TestMonthModel_View_Comprehensive(t *testing.T) {
tests := []int{
2022,
2023,
2024,
2025,
}

for _, year := range tests {
t.Run(strconv.Itoa(year), func(t *testing.T) {
// Setup
var gots []string
for i := time.January; i <= time.December; i += 1 {

tm := NewMonth(year, i)
_ = tm.Init()

// Test
c := tm.View()
gots = append(gots, ansi.Strip(c))
}

// Assertions
got := strings.Join(gots, "\n")
golden.RequireEqual(t, []byte(got))
})
}
}

func TestMonthModel_Title(t *testing.T) {
year := 2024
month := time.September
Expand Down
Loading

0 comments on commit ad5b8f0

Please sign in to comment.