@@ -2,8 +2,14 @@ import org.scalatest.path.FunSpec
2
2
import scala .concurrent .Await
3
3
import scala .concurrent .ExecutionContext .Implicits .global
4
4
import codecheck .github .models .SortDirection
5
- import codecheck .github .models .SearchInput
6
- import codecheck .github .models .SearchSort
5
+ import codecheck .github .models .SearchRepositoryInput
6
+ import codecheck .github .models .SearchCodeInput
7
+ import codecheck .github .models .SearchIssueInput
8
+ import codecheck .github .models .SearchUserInput
9
+ import codecheck .github .models .SearchRepositorySort
10
+ import codecheck .github .models .SearchCodeSort
11
+ import codecheck .github .models .SearchIssueSort
12
+ import codecheck .github .models .SearchUserSort
7
13
import codecheck .github .models .SearchRepositoryResult
8
14
import codecheck .github .models .SearchCodeResult
9
15
import codecheck .github .models .searchCodeItems
@@ -17,7 +23,7 @@ class SearchOpSpec extends FunSpec
17
23
it(" with valid SearchInput should succeed" ) {
18
24
var q = " tetris language:assembly"
19
25
val q1 = q.trim.replaceAll(" " ," +" );
20
- val input = SearchInput (q1,sort= Some (SearchSort .stars),order= SortDirection .desc)
26
+ val input = SearchRepositoryInput (q1,sort= Some (SearchRepositorySort .stars),order= SortDirection .desc)
21
27
val res = Await .result(api.searchRepositories(input), TIMEOUT )
22
28
assert(res.total_count >= 1 )
23
29
assert(res.items(0 ).id >= 1 )
@@ -31,7 +37,7 @@ class SearchOpSpec extends FunSpec
31
37
it(" with valid changed query(q) SearchInput should succeed" ) {
32
38
var q = " jquery in:name,description"
33
39
val q1 = q.trim.replaceAll(" " ," +" );
34
- val input = SearchInput (q1,sort= Some (SearchSort .stars),order= SortDirection .desc)
40
+ val input = SearchRepositoryInput (q1,sort= Some (SearchRepositorySort .stars),order= SortDirection .desc)
35
41
val res = Await .result(api.searchRepositories(input), TIMEOUT )
36
42
assert(res.total_count >= 1 )
37
43
assert(res.items(0 ).id >= 1 )
@@ -45,7 +51,7 @@ class SearchOpSpec extends FunSpec
45
51
it(" with valid SearchInput q,no SortOrder should succeed" ) {
46
52
var q = " addClass in:file language:js repo:jquery/jquery"
47
53
val q1 = q.trim.replaceAll(" " ," +" );
48
- val input = SearchInput (q1,sort= None ,order= SortDirection .desc)
54
+ val input = SearchCodeInput (q1,sort= None ,order= SortDirection .desc)
49
55
val res = Await .result(api.searchCode(input), TIMEOUT )
50
56
assert(res.total_count >= 1 )
51
57
assert(res.items(0 ).Repo .id >= 1 )
@@ -58,7 +64,7 @@ class SearchOpSpec extends FunSpec
58
64
it(" with valid SearchInput it should succeed" ) {
59
65
var q = " function size:10000 language:python"
60
66
val q1 = q.trim.replaceAll(" " ," +" );
61
- val input = SearchInput (q1,sort= Some (SearchSort .indexed),order= SortDirection .desc)
67
+ val input = SearchCodeInput (q1,sort= Some (SearchCodeSort .indexed),order= SortDirection .desc)
62
68
try {
63
69
val res = Await .result(api.searchCode(input), TIMEOUT )
64
70
} catch {
@@ -72,7 +78,7 @@ class SearchOpSpec extends FunSpec
72
78
it(" with valid SearchInput should succeed" ) {
73
79
var q = " windows label:bug language:python state:open"
74
80
val q1 = q.trim.replaceAll(" " ," +" );
75
- val input = SearchInput (q1,sort= Some (SearchSort .created),order= SortDirection .desc)
81
+ val input = SearchIssueInput (q1,sort= Some (SearchIssueSort .created),order= SortDirection .desc)
76
82
val res = Await .result(api.searchIssues(input), TIMEOUT )
77
83
assert(res.total_count >= 1 )
78
84
assert(res.items(0 ).labels(0 ).name == " bug" )
@@ -85,7 +91,7 @@ class SearchOpSpec extends FunSpec
85
91
var q = " tom repos:>42 followers:>1000"
86
92
q = q.trim.replaceAll(" " ," +" )
87
93
val q1 = q.replaceAll(" >" ," %3E" )
88
- val input = SearchInput (q1,sort= None ,order= SortDirection .desc)
94
+ val input = SearchUserInput (q1,sort= None ,order= SortDirection .desc)
89
95
val res = Await .result(api.searchUser(input), TIMEOUT )
90
96
assert(res.total_count >= 0 )
91
97
assert(res.items(0 ).login.length >= 0 )
0 commit comments