From dd91ecac477ca79e71983af844f9db0f2bb6bc52 Mon Sep 17 00:00:00 2001 From: Julio <1953782+julio-lopez@users.noreply.github.com> Date: Mon, 8 Jan 2024 15:12:06 -0800 Subject: [PATCH] factored out test case to TestFormatDateHelperElapsedYear --- internal/adapter/handlebars/handlebars_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/adapter/handlebars/handlebars_test.go b/internal/adapter/handlebars/handlebars_test.go index d7931ec..3a806ec 100644 --- a/internal/adapter/handlebars/handlebars_test.go +++ b/internal/adapter/handlebars/handlebars_test.go @@ -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") }