aboutsummaryrefslogtreecommitdiffstats
path: root/modules/convert/issue_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/convert/issue_test.go')
-rw-r--r--modules/convert/issue_test.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/modules/convert/issue_test.go b/modules/convert/issue_test.go
index a7286d0766..e5676293f8 100644
--- a/modules/convert/issue_test.go
+++ b/modules/convert/issue_test.go
@@ -6,9 +6,11 @@ package convert
import (
"testing"
+ "time"
"code.gitea.io/gitea/models"
api "code.gitea.io/gitea/modules/structs"
+ "code.gitea.io/gitea/modules/timeutil"
"github.com/stretchr/testify/assert"
)
@@ -22,3 +24,25 @@ func TestLabel_ToLabel(t *testing.T) {
Color: "abcdef",
}, ToLabel(label))
}
+
+func TestMilestone_APIFormat(t *testing.T) {
+ milestone := &models.Milestone{
+ ID: 3,
+ RepoID: 4,
+ Name: "milestoneName",
+ Content: "milestoneContent",
+ IsClosed: false,
+ NumOpenIssues: 5,
+ NumClosedIssues: 6,
+ DeadlineUnix: timeutil.TimeStamp(time.Date(2000, time.January, 1, 0, 0, 0, 0, time.UTC).Unix()),
+ }
+ assert.Equal(t, api.Milestone{
+ ID: milestone.ID,
+ State: api.StateOpen,
+ Title: milestone.Name,
+ Description: milestone.Content,
+ OpenIssues: milestone.NumOpenIssues,
+ ClosedIssues: milestone.NumClosedIssues,
+ Deadline: milestone.DeadlineUnix.AsTimePtr(),
+ }, *ToAPIMilestone(milestone))
+}