summaryrefslogtreecommitdiffstats
path: root/models/issues/content_history_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/issues/content_history_test.go')
-rw-r--r--models/issues/content_history_test.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/models/issues/content_history_test.go b/models/issues/content_history_test.go
index f040a7dc57..cc9a7c5107 100644
--- a/models/issues/content_history_test.go
+++ b/models/issues/content_history_test.go
@@ -53,6 +53,11 @@ func TestContentHistory(t *testing.T) {
list2, _ := FetchIssueContentHistoryList(dbCtx, 10, 100)
assert.Len(t, list2, 5)
+ hasHistory1, _ := HasIssueContentHistory(dbCtx, 10, 0)
+ assert.True(t, hasHistory1)
+ hasHistory2, _ := HasIssueContentHistory(dbCtx, 10, 1)
+ assert.False(t, hasHistory2)
+
h6, h6Prev, _ := GetIssueContentHistoryAndPrev(dbCtx, 6)
assert.EqualValues(t, 6, h6.ID)
assert.EqualValues(t, 5, h6Prev.ID)
@@ -63,13 +68,13 @@ func TestContentHistory(t *testing.T) {
assert.EqualValues(t, 6, h6.ID)
assert.EqualValues(t, 4, h6Prev.ID)
- // only keep 3 history revisions for comment_id=100
+ // only keep 3 history revisions for comment_id=100, the first and the last should never be deleted
keepLimitedContentHistory(dbEngine, 10, 100, 3)
list1, _ = FetchIssueContentHistoryList(dbCtx, 10, 0)
assert.Len(t, list1, 3)
list2, _ = FetchIssueContentHistoryList(dbCtx, 10, 100)
assert.Len(t, list2, 3)
- assert.EqualValues(t, 7, list2[0].HistoryID)
- assert.EqualValues(t, 6, list2[1].HistoryID)
+ assert.EqualValues(t, 8, list2[0].HistoryID)
+ assert.EqualValues(t, 7, list2[1].HistoryID)
assert.EqualValues(t, 4, list2[2].HistoryID)
}