Use fixed days to test translateTimestamp for months

Use fixed days to avoid days in different months.
pull/6/head
hurf 2015-12-08 15:53:38 +08:00
parent d0d27be9b0
commit fb6ea4385b
1 changed files with 1 additions and 0 deletions

View File

@ -1217,6 +1217,7 @@ func TestTranslateTimestamp(t *testing.T) {
{"5 minutes ago", translateTimestamp(unversioned.Time{Time: time.Now().Add(-3e11)}), "5m"},
{"an hour ago", translateTimestamp(unversioned.Time{Time: time.Now().Add(-6e12)}), "1h"},
{"2 days ago", translateTimestamp(unversioned.Time{Time: time.Now().AddDate(0, 0, -2)}), "2d"},
{"months ago", translateTimestamp(unversioned.Time{Time: time.Now().AddDate(0, 0, -90)}), "90d"},
{"10 years ago", translateTimestamp(unversioned.Time{Time: time.Now().AddDate(-10, 0, 0)}), "10y"},
}
for _, test := range tl {