Skip to content

Commit 62e4424

Browse files
committed
Update tests to match new time format
1 parent 2a0c27f commit 62e4424

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

models/issue_tracked_time_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func TestAddTime(t *testing.T) {
3434
assert.Equal(t, int64(3661), tt.Time)
3535

3636
comment := unittest.AssertExistsAndLoadBean(t, &Comment{Type: CommentTypeAddTimeManual, PosterID: 3, IssueID: 1}).(*Comment)
37-
assert.Equal(t, comment.Content, "1h 1m 1s")
37+
assert.Equal(t, comment.Content, "1 hour 1 minute")
3838
}
3939

4040
func TestGetTrackedTimes(t *testing.T) {
@@ -86,17 +86,17 @@ func TestTotalTimes(t *testing.T) {
8686
assert.Len(t, total, 1)
8787
for user, time := range total {
8888
assert.Equal(t, int64(1), user.ID)
89-
assert.Equal(t, "6m 40s", time)
89+
assert.Equal(t, "6 minutes 40 seconds", time)
9090
}
9191

9292
total, err = TotalTimes(&FindTrackedTimesOptions{IssueID: 2})
9393
assert.NoError(t, err)
9494
assert.Len(t, total, 2)
9595
for user, time := range total {
9696
if user.ID == 2 {
97-
assert.Equal(t, "1h 1m 2s", time)
97+
assert.Equal(t, "1 hour 1 minute", time)
9898
} else if user.ID == 1 {
99-
assert.Equal(t, "20s", time)
99+
assert.Equal(t, "20 seconds", time)
100100
} else {
101101
assert.Error(t, assert.AnError)
102102
}
@@ -107,7 +107,7 @@ func TestTotalTimes(t *testing.T) {
107107
assert.Len(t, total, 1)
108108
for user, time := range total {
109109
assert.Equal(t, int64(2), user.ID)
110-
assert.Equal(t, "1s", time)
110+
assert.Equal(t, "1 second", time)
111111
}
112112

113113
total, err = TotalTimes(&FindTrackedTimesOptions{IssueID: 4})

models/migrations/v210.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import (
1111
"strings"
1212

1313
"code.gitea.io/gitea/modules/timeutil"
14-
"github.com/tstranex/u2f"
1514

15+
"github.com/tstranex/u2f"
1616
"xorm.io/xorm"
1717
"xorm.io/xorm/schemas"
1818
)

models/migrations/v210_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"testing"
99

1010
"code.gitea.io/gitea/modules/timeutil"
11+
1112
"github.com/stretchr/testify/assert"
1213
"xorm.io/xorm/schemas"
1314
)

modules/util/sec_to_time.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func SecToTime(duration int64) string {
5757
// formattedTime = "1 year"
5858
// input: value = 3, name = "month"
5959
// output will be "1 year 3 months"
60-
func FormatTime(value int64, name string, formattedTime string) string {
60+
func FormatTime(value int64, name, formattedTime string) string {
6161
if value == 1 {
6262
formattedTime = fmt.Sprintf("%s1 %s ", formattedTime, name)
6363
} else if value > 1 {

0 commit comments

Comments
 (0)