Skip to content

Commit

Permalink
Add tests for conversation indexer
Browse files Browse the repository at this point in the history
  • Loading branch information
RedCocoon committed Nov 7, 2024
1 parent 93e125e commit dc10ad9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
12 changes: 10 additions & 2 deletions models/fixtures/conversation_comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
type: 0 # comment
poster_id: 2
conversation_id: 1 # in repo_id 1
content: "1"
content: "1first"
created_unix: 946684810
-
id: 2
Expand All @@ -21,11 +21,19 @@
content: "meh..."
created_unix: 946684812
updated_unix: 946684812
-
id: 4
type: 0 # comment
poster_id: 2
conversation_id: 2 # in repo_id 1
content: "conversationcomment2"
created_unix: 946684811
updated_unix: 946684811
-
id: 4
type: 0 # comment
poster_id: 2
conversation_id: 4 # in repo_id 2
content: "comment in private pository"
created_unix: 946684811
updated_unix: 946684811
updated_unix: 946684811

Check failure on line 39 in models/fixtures/conversation_comment.yml

View workflow job for this annotation

GitHub Actions / lint-yaml

39:26 [new-line-at-end-of-file] no new line character at the end of file
11 changes: 5 additions & 6 deletions modules/indexer/conversations/indexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func searchConversationWithKeyword(t *testing.T) {
}{
{
SearchOptions{
Keyword: "conversation2",
Keyword: "conversationcomment2",
RepoIDs: []int64{1},
},
[]int64{2},
Expand All @@ -59,17 +59,16 @@ func searchConversationWithKeyword(t *testing.T) {
},
{
SearchOptions{
Keyword: "for",
Keyword: "good",
RepoIDs: []int64{1},
},
[]int64{11, 5, 3, 2, 1},
[]int64{1},
},
{
SearchOptions{
Keyword: "good",
RepoIDs: []int64{1},
Keyword: "comment",
},
[]int64{1},
[]int64{2, 4},
},
}

Expand Down

0 comments on commit dc10ad9

Please sign in to comment.