@@ -18,41 +18,38 @@ class SearchOpSpec extends FunSpec
18
18
var q = " tetris language:assembly"
19
19
val q1 = q.trim.replaceAll(" " ," +" );
20
20
val input = SearchInput (q1,sort= Some (SearchSort .stars),order= SortDirection .desc)
21
- Await .result(api.searchRepositories(input), TIMEOUT ).map { res =>
22
- assert(res.total_count >= 1 )
23
- assert(res.items(0 ).id >= 1 )
24
- assert(res.items(0 ).name.length >= 1 )
25
- assert(res.items(0 ).full_name.length >= 1 )
26
- assert(res.items(0 ).description.isDefined)
27
- assert(res.items(0 ).open_issues_count >= 0 )
28
- assert(res.items(0 ).language == " Assembly" )
29
- assert(res.items(0 ).stargazers_count > res.items(1 ).stargazers_count)
30
- }
21
+ val res = Await .result(api.searchRepositories(input), TIMEOUT )
22
+ assert(res.total_count >= 1 )
23
+ assert(res.items(0 ).id >= 1 )
24
+ assert(res.items(0 ).name.length >= 1 )
25
+ assert(res.items(0 ).full_name.length >= 1 )
26
+ assert(res.items(0 ).description.isDefined)
27
+ assert(res.items(0 ).open_issues_count >= 0 )
28
+ assert(res.items(0 ).language == " Assembly" )
29
+ assert(res.items(0 ).stargazers_count > res.items(1 ).stargazers_count)
31
30
}
32
31
it(" with valid changed query(q) SearchInput should succeed" ) {
33
32
var q = " jquery in:name,description"
34
33
val q1 = q.trim.replaceAll(" " ," +" );
35
34
val input = SearchInput (q1,sort= Some (SearchSort .stars),order= SortDirection .desc)
36
- Await .result(api.searchRepositories(input), TIMEOUT ).map { res =>
37
- assert(res.total_count >= 1 )
38
- assert(res.items(0 ).id >= 1 )
39
- assert(res.items(0 ).name.length >= 1 )
40
- assert(res.items(0 ).full_name.length >= 1 )
41
- assert(res.items(0 ).description.isDefined)
42
- assert(res.items(0 ).open_issues_count >= 0 )
43
- }
35
+ val res = Await .result(api.searchRepositories(input), TIMEOUT )
36
+ assert(res.total_count >= 1 )
37
+ assert(res.items(0 ).id >= 1 )
38
+ assert(res.items(0 ).name.length >= 1 )
39
+ assert(res.items(0 ).full_name.length >= 1 )
40
+ assert(res.items(0 ).description.isDefined)
41
+ assert(res.items(0 ).open_issues_count >= 0 )
44
42
}
45
43
}
46
44
describe(" searchCode" ) {
47
45
it(" with valid SearchInput q,no SortOrder should succeed" ) {
48
46
var q = " addClass in:file language:js repo:jquery/jquery"
49
47
val q1 = q.trim.replaceAll(" " ," +" );
50
48
val input = SearchInput (q1,sort= None ,order= SortDirection .desc)
51
- Await .result(api.searchCode(input), TIMEOUT ).map { res =>
52
- assert(res.total_count >= 1 )
53
- assert(res.items(0 ).Repo .id >= 1 )
54
- assert(res.items(0 ).Repo .full_name == " jquery/jquery" )
55
- }
49
+ val res = Await .result(api.searchCode(input), TIMEOUT )
50
+ assert(res.total_count >= 1 )
51
+ assert(res.items(0 ).Repo .id >= 1 )
52
+ assert(res.items(0 ).Repo .full_name == " jquery/jquery" )
56
53
}
57
54
// Following test results in error:
58
55
// "message" : "Validation Failed",
@@ -77,26 +74,23 @@ class SearchOpSpec extends FunSpec
77
74
var q = " windows label:bug language:python state:open"
78
75
val q1 = q.trim.replaceAll(" " ," +" );
79
76
val input = SearchInput (q1,sort= Some (SearchSort .created),order= SortDirection .asc)
80
- Await .result(api.searchIssues(input), TIMEOUT ).map { res =>
81
- assert(res.total_count >= 1 )
82
- assert(res.items(0 ).labels(0 ).name == " bug" )
83
- assert(res.items(0 ).state == " open" )
84
- assert(((res.items(0 ).created_at).compareTo(res.items(1 ).created_at)) > 0 )
85
- }
77
+ val res = Await .result(api.searchIssues(input), TIMEOUT )
78
+ assert(res.total_count >= 1 )
79
+ assert(res.items(0 ).labels(0 ).name == " bug" )
80
+ assert(res.items(0 ).state == " open" )
81
+ assert(((res.items(0 ).created_at).compareTo(res.items(1 ).created_at)) > 0 )
86
82
}
87
83
}
88
84
describe(" searchUser" ) {
89
85
it(" with valid SearchInput should succeed" ) {
90
86
var q = " tom repos:>42 followers:>1000"
91
87
q = q.trim.replaceAll(" " ," +" )
92
88
val q1 = q.replaceAll(" >" ," %3E" )
93
- println(" QUERY: searchUser" + q1)
94
89
val input = SearchInput (q1,sort= None ,order= SortDirection .desc)
95
- Await .result(api.searchUser(input), TIMEOUT ).map { res =>
96
- assert(res.total_count >= 1 )
97
- assert(res.items(0 ).login.length >= 1 )
98
- assert(res.items(0 ).id >= 1 )
99
- }
90
+ val res = Await .result(api.searchUser(input), TIMEOUT )
91
+ assert(res.total_count >= 1 )
92
+ assert(res.items(0 ).login.length >= 1 )
93
+ assert(res.items(0 ).id >= 1 )
100
94
}
101
95
}
102
96
}
0 commit comments