Skip to content

Commit

Permalink
factored out test case to TestFormatDateHelperElapsedYear
Browse files Browse the repository at this point in the history
  • Loading branch information
julio-lopez committed Jan 8, 2024
1 parent b1ecd94 commit dd91eca
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/adapter/handlebars/handlebars_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,11 @@ func TestFormatDateHelper(t *testing.T) {
testString(t, "{{format-date now 'timestamp'}}", context, "200911172034")
testString(t, "{{format-date now 'timestamp-unix'}}", context, "1258490098")
testString(t, "{{format-date now 'cust: %Y-%m'}}", context, "cust: 2009-11")
}

func TestFormatDateHelperElapsedYear(t *testing.T) {
year := time.Now().UTC().Year() - 14
context = map[string]interface{}{"now": time.Date(year, 11, 17, 20, 34, 58, 651387237, time.UTC)}
context := map[string]interface{}{"now": time.Date(year, 11, 17, 20, 34, 58, 651387237, time.UTC)}
testString(t, "{{format-date now 'elapsed'}}", context, "14 years ago")
}

Expand Down

0 comments on commit dd91eca

Please sign in to comment.