Skip to content

Commit 8b68cc8

Browse files
committed
Fix warning lines and remove unused variables
1 parent 56fca5e commit 8b68cc8

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

models/conversations/conversation_test.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,11 @@ func TestConversation_InsertConversation(t *testing.T) {
130130
assert.NoError(t, unittest.PrepareTestDatabase())
131131

132132
// there are 5 conversations and max index is 5 on repository 1, so this one should 6
133-
conversation := testInsertConversation(t, "my conversation1", "special conversation's comments?", 6)
133+
conversation := testInsertConversation(t, "my conversation1", 6)
134134
_, err := db.DeleteByID[conversations_model.Conversation](db.DefaultContext, conversation.ID)
135135
assert.NoError(t, err)
136136

137-
conversation = testInsertConversation(t, `my conversation2, this is my son's love \n \r \ `, "special conversation's '' comments?", 7)
137+
conversation = testInsertConversation(t, `my conversation2, this is my son's love \n \r \ `, 7)
138138
_, err = db.DeleteByID[conversations_model.Conversation](db.DefaultContext, conversation.ID)
139139
assert.NoError(t, err)
140140
}
@@ -146,7 +146,7 @@ func TestResourceIndex(t *testing.T) {
146146
for i := 0; i < 100; i++ {
147147
wg.Add(1)
148148
go func(i int) {
149-
testInsertConversation(t, fmt.Sprintf("conversation %d", i+1), "my conversation", 0)
149+
testInsertConversation(t, fmt.Sprintf("conversation %d", i+1), 0)
150150
wg.Done()
151151
}(i)
152152
}
@@ -168,7 +168,7 @@ func TestCorrectConversationStats(t *testing.T) {
168168
for i := 0; i < conversationAmount; i++ {
169169
wg.Add(1)
170170
go func(i int) {
171-
testInsertConversation(t, fmt.Sprintf("Conversation %d", i+1), "Bugs are nasty", 0)
171+
testInsertConversation(t, fmt.Sprintf("Conversation %d", i+1), 0)
172172
wg.Done()
173173
}(i)
174174
}
@@ -228,7 +228,11 @@ func TestConversationLoadAttributes(t *testing.T) {
228228
}
229229
}
230230

231-
func assertCreateConversations(t *testing.T, isPull bool) {
231+
func TestCreateConversation(t *testing.T) {
232+
assertCreateConversations(t)
233+
}
234+
235+
func assertCreateConversations(t *testing.T) {
232236
assert.NoError(t, unittest.PrepareTestDatabase())
233237
reponame := "repo1"
234238
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{Name: reponame})
@@ -245,7 +249,7 @@ func assertCreateConversations(t *testing.T, isPull bool) {
245249
unittest.AssertExistsAndLoadBean(t, &conversations_model.Conversation{RepoID: repo.ID, ID: conversationID})
246250
}
247251

248-
func testInsertConversation(t *testing.T, title, content string, expectIndex int64) *conversations_model.Conversation {
252+
func testInsertConversation(t *testing.T, title string, expectIndex int64) *conversations_model.Conversation {
249253
var newConversation conversations_model.Conversation
250254
t.Run(title, func(t *testing.T) {
251255
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})

models/conversations/conversation_update.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ func NewConversation(ctx context.Context, repo *repo_model.Repository, conversat
423423
}
424424

425425
if err = committer.Commit(); err != nil {
426-
return fmt.Errorf("Commit: %w", err)
426+
return fmt.Errorf("commit: %w", err)
427427
}
428428

429429
return nil

0 commit comments

Comments
 (0)