github.com/shoshinnikita/budget-manager@v0.7.1-0.20220131195411-8c46ff1c6778/internal/web/pages/utils_test.go (about) 1 package pages 2 3 import ( 4 "testing" 5 "time" 6 7 "github.com/stretchr/testify/require" 8 ) 9 10 func TestToShortMonth(t *testing.T) { 11 t.Parallel() 12 13 require := require.New(t) 14 15 tests := []struct { 16 m time.Month 17 want string 18 }{ 19 {m: time.January, want: "Jan"}, 20 {m: time.February, want: "Feb"}, 21 {m: time.March, want: "Mar"}, 22 {m: time.April, want: "Apr"}, 23 {m: time.May, want: "May"}, 24 {m: time.June, want: "June"}, 25 {m: time.July, want: "July"}, 26 {m: time.August, want: "Aug"}, 27 {m: time.September, want: "Sep"}, 28 {m: time.October, want: "Oct"}, 29 {m: time.November, want: "Nov"}, 30 {m: time.December, want: "Dec"}, 31 } 32 33 for _, tt := range tests { 34 res := toShortMonth(tt.m) 35 require.Equal(tt.want, res) 36 } 37 }