Skip to content

Commit 8e012eb

Browse files
committed
add comments for testing conversation search
1 parent 5b9049d commit 8e012eb

File tree

1 file changed

+17
-38
lines changed
  • modules/indexer/conversations/internal/tests

1 file changed

+17
-38
lines changed

modules/indexer/conversations/internal/tests/tests.go

Lines changed: 17 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -120,25 +120,25 @@ var cases = []*testIndexerCase{
120120
Name: "Keyword",
121121
ExtraData: []*internal.IndexerData{
122122
{ID: 1000},
123-
{ID: 1001},
123+
{ID: 1001, Comments: []string{"hi", "hello world"}},
124124
{ID: 1002, Comments: []string{"hi", "hello world"}},
125125
},
126126
SearchOptions: &internal.SearchOptions{
127127
Keyword: "hello",
128128
},
129-
ExpectedIDs: []int64{1002, 1001, 1000},
130-
ExpectedTotal: 3,
129+
ExpectedIDs: []int64{1002, 1001},
130+
ExpectedTotal: 2,
131131
},
132132
{
133133
Name: "RepoIDs",
134134
ExtraData: []*internal.IndexerData{
135-
{ID: 1001, RepoID: 1, IsPublic: false},
136-
{ID: 1002, RepoID: 1, IsPublic: false},
137-
{ID: 1003, RepoID: 2, IsPublic: true},
138-
{ID: 1004, RepoID: 2, IsPublic: true},
139-
{ID: 1005, RepoID: 3, IsPublic: true},
140-
{ID: 1006, RepoID: 4, IsPublic: false},
141-
{ID: 1007, RepoID: 5, IsPublic: false},
135+
{ID: 1001, RepoID: 1, IsPublic: false, Comments: []string{"hi", "hello world"}},
136+
{ID: 1002, RepoID: 1, IsPublic: false, Comments: []string{"hi", "hello world"}},
137+
{ID: 1003, RepoID: 2, IsPublic: true, Comments: []string{"hi", "hello world"}},
138+
{ID: 1004, RepoID: 2, IsPublic: true, Comments: []string{"hi", "hello world"}},
139+
{ID: 1005, RepoID: 3, IsPublic: true, Comments: []string{"hi", "hello world"}},
140+
{ID: 1006, RepoID: 4, IsPublic: false, Comments: []string{"hi", "hello world"}},
141+
{ID: 1007, RepoID: 5, IsPublic: false, Comments: []string{"hi", "hello world"}},
142142
},
143143
SearchOptions: &internal.SearchOptions{
144144
Keyword: "hello",
@@ -150,13 +150,13 @@ var cases = []*testIndexerCase{
150150
{
151151
Name: "RepoIDs and AllPublic",
152152
ExtraData: []*internal.IndexerData{
153-
{ID: 1001, RepoID: 1, IsPublic: false},
154-
{ID: 1002, RepoID: 1, IsPublic: false},
155-
{ID: 1003, RepoID: 2, IsPublic: true},
156-
{ID: 1004, RepoID: 2, IsPublic: true},
157-
{ID: 1005, RepoID: 3, IsPublic: true},
158-
{ID: 1006, RepoID: 4, IsPublic: false},
159-
{ID: 1007, RepoID: 5, IsPublic: false},
153+
{ID: 1001, RepoID: 1, IsPublic: false, Comments: []string{"hi", "hello world"}},
154+
{ID: 1002, RepoID: 1, IsPublic: false, Comments: []string{"hi", "hello world"}},
155+
{ID: 1003, RepoID: 2, IsPublic: true, Comments: []string{"hi", "hello world"}},
156+
{ID: 1004, RepoID: 2, IsPublic: true, Comments: []string{"hi", "hello world"}},
157+
{ID: 1005, RepoID: 3, IsPublic: true, Comments: []string{"hi", "hello world"}},
158+
{ID: 1006, RepoID: 4, IsPublic: false, Comments: []string{"hi", "hello world"}},
159+
{ID: 1007, RepoID: 5, IsPublic: false, Comments: []string{"hi", "hello world"}},
160160
},
161161
SearchOptions: &internal.SearchOptions{
162162
Keyword: "hello",
@@ -350,27 +350,6 @@ func generateDefaultIndexerData() []*internal.IndexerData {
350350
comments[i] = fmt.Sprintf("comment%d", i)
351351
}
352352

353-
labelIDs := make([]int64, id%5)
354-
for i := range labelIDs {
355-
labelIDs[i] = int64(i) + 1 // LabelID should not be 0
356-
}
357-
mentionIDs := make([]int64, id%6)
358-
for i := range mentionIDs {
359-
mentionIDs[i] = int64(i) + 1 // MentionID should not be 0
360-
}
361-
reviewedIDs := make([]int64, id%7)
362-
for i := range reviewedIDs {
363-
reviewedIDs[i] = int64(i) + 1 // ReviewID should not be 0
364-
}
365-
reviewRequestedIDs := make([]int64, id%8)
366-
for i := range reviewRequestedIDs {
367-
reviewRequestedIDs[i] = int64(i) + 1 // ReviewRequestedID should not be 0
368-
}
369-
subscriberIDs := make([]int64, id%9)
370-
for i := range subscriberIDs {
371-
subscriberIDs[i] = int64(i) + 1 // SubscriberID should not be 0
372-
}
373-
374353
data = append(data, &internal.IndexerData{
375354
ID: id,
376355
RepoID: repoID,

0 commit comments

Comments
 (0)