mirror of
https://github.com/eiblog/eiblog.git
synced 2026-02-23 06:32:28 +08:00
fix comments duration
This commit is contained in:
@@ -44,15 +44,21 @@ func TestPickFirstImage(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCovertStr(t *testing.T) {
|
||||
now := time.Now().UTC()
|
||||
testStr := []string{
|
||||
time.Now().Format("2006-01-02T15:04:05"),
|
||||
now.Format("2006-01-02T15:04:05"),
|
||||
now.Add(-time.Second * 20).Format("2006-01-02T15:04:05"),
|
||||
now.Add(-time.Minute).Format("2006-01-02T15:04:05"),
|
||||
now.Add(-time.Minute * 2).Format("2006-01-02T15:04:05"),
|
||||
now.Add(-time.Minute * 20).Format("2006-01-02T15:04:05"),
|
||||
now.Add(-time.Hour).Format("2006-01-02T15:04:05"),
|
||||
now.Add(-time.Hour * 2).Format("2006-01-02T15:04:05"),
|
||||
now.Add(-time.Hour * 24).Format("2006-01-02T15:04:05"),
|
||||
}
|
||||
|
||||
expectStr := []string{
|
||||
JUST_NOW,
|
||||
}
|
||||
|
||||
for i, v := range testStr {
|
||||
assert.Equal(t, expectStr[i], ConvertStr(v))
|
||||
time.Sleep(time.Second)
|
||||
t.Log(now.Format("2006-01-02T15:04:05"))
|
||||
for _, v := range testStr {
|
||||
t.Log(v, ConvertStr(v))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user