Skip to content

Commit

Permalink
✅ test: update test case
Browse files Browse the repository at this point in the history
  • Loading branch information
jingyuexing committed Jan 31, 2024
1 parent 3811286 commit a7c46a9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,18 +278,18 @@ func TestDateTimeFormat(t *testing.T) {

result1 := utils.DateTimeFormat(datetime, "YY/MM/dd")
if result1 != "24/01/30" {
t.Error("format date wrong")
t.Error(fmt.Sprintf("Expect: %s, but got %s","24/01/30",result1))
}

result2 := utils.DateTimeFormat(datetime, "MM/dd/YYYY HH:mm:ss")

if result2 != "01/30/2024 07:51:32" {
t.Error("format datetime wrong")
t.Error(fmt.Sprintf("Expect: %s, but got %s","01/30/2024 07:51:32",result2))
}

result3 := utils.DateTimeFormat(datetime, "YYYY年M月d日 H时m分s秒")
if result3 != "2024年1月30日 7时51分32秒" {
t.Error("format has wrong")
t.Error(fmt.Sprintf("Expect: %s, but got %s","2024年1月30日 7时51分32秒",result3))
}
}

Expand All @@ -316,11 +316,11 @@ func TestDateTime(t *testing.T) {


if datetime.String() != "2024-01-30T07:51:32.5132Z" {
t.Error("format time has wrong")
t.Error(fmt.Sprintf("Expect: %s, but got %s","2024-01-30T07:51:32.5132Z",datetime.String()))
}

if datetime.Add(100,"D").String() != "2024-05-09T07:51:32.5132Z" {
t.Error("add 100 days has wrong")
t.Error(fmt.Sprintf("Expect: %s, but got %s","2024-01-30T07:51:32.5132Z",datetime.Add(100,"D").String()))
}

if datetime.CurrentYearDays() != 366 {
Expand Down

0 comments on commit a7c46a9

Please sign in to comment.