File tree Expand file tree Collapse file tree 7 files changed +43
-95
lines changed
Tests/GraphitiTests/StarWarsTests Expand file tree Collapse file tree 7 files changed +43
-95
lines changed Original file line number Diff line number Diff line change 1
- 4.1
1
+ 4.2
Original file line number Diff line number Diff line change 5
5
include :
6
6
- os : osx
7
7
env : JOB=SwiftPM_OSX
8
- osx_image : xcode9.3beta
8
+ osx_image : xcode10.1
9
9
- os : linux
10
10
env : JOB=SwiftPM_linux
11
11
dist : trusty
Original file line number Diff line number Diff line change 6
6
"repositoryURL" : " https://github.com/vapor/core.git" ,
7
7
"state" : {
8
8
"branch" : null ,
9
- "revision" : " 174f909bc048a6aff27d6cb4c31810971f912cca" ,
10
- "version" : " 3.2.2"
9
+ "revision" : " 1794ff138bd669175a2528d27695028d7cb30471" ,
10
+ "version" : " 3.5.0"
11
+ }
12
+ },
13
+ {
14
+ "package" : " CRuntime" ,
15
+ "repositoryURL" : " https://github.com/wickwirew/CRuntime.git" ,
16
+ "state" : {
17
+ "branch" : null ,
18
+ "revision" : " 8d0dd0ca3787d15682c1f44de3d298459870b121" ,
19
+ "version" : " 1.0.0"
11
20
}
12
21
},
13
22
{
14
23
"package" : " GraphQL" ,
15
24
"repositoryURL" : " https://github.com/GraphQLSwift/GraphQL.git" ,
16
25
"state" : {
17
- "branch" : null ,
18
- "revision" : " 1ab3c9050cb0aea4350dbc343454bb8c83adff34 " ,
19
- "version" : " 0.6.0 "
26
+ "branch" : " master " ,
27
+ "revision" : " 2ba73c3691dbcdeb6e09ad4f6df46536ba692c83 " ,
28
+ "version" : null
20
29
}
21
30
},
22
31
{
23
32
"package" : " Runtime" ,
24
33
"repositoryURL" : " https://github.com/wickwirew/Runtime.git" ,
25
34
"state" : {
26
35
"branch" : null ,
27
- "revision" : " 23357609f0df427d870bb4bd22ac14e0a4ea1346 " ,
28
- "version" : " 0.7.1 "
36
+ "revision" : " 40cdfbad9650512507c060824e1c4e9fc2ca721d " ,
37
+ "version" : " 1.1.0 "
29
38
}
30
39
},
31
40
{
32
41
"package" : " swift-nio" ,
33
42
"repositoryURL" : " https://github.com/apple/swift-nio.git" ,
34
43
"state" : {
35
44
"branch" : null ,
36
- "revision" : " 695afc5205aaa49fca092b94b479ff71c43d9d3c " ,
37
- "version" : " 1.8.0 "
45
+ "revision" : " 03c541a24dd0558c942b15d8464eb75d70a921c4 " ,
46
+ "version" : " 1.12.1 "
38
47
}
39
48
},
40
49
{
Original file line number Diff line number Diff line change 1
- // swift-tools-version:4.0
1
+ // swift-tools-version:4.2
2
2
import PackageDescription
3
3
4
4
let package = Package (
@@ -9,7 +9,7 @@ let package = Package(
9
9
] ,
10
10
11
11
dependencies: [
12
- . package ( url: " https://github.com/GraphQLSwift/GraphQL.git " , from: " 0.6 .0 " ) ,
12
+ . package ( url: " https://github.com/GraphQLSwift/GraphQL.git " , from: " 0.8 .0 " ) ,
13
13
] ,
14
14
15
15
targets: [
Original file line number Diff line number Diff line change @@ -210,23 +210,26 @@ func search(for value: String) -> [SearchResult] {
210
210
let value = value. lowercased ( )
211
211
var result : [ SearchResult ] = [ ]
212
212
213
- result. append ( contentsOf:
214
- planetData. filter ( {
215
- return $1. name. lowercased ( ) . range ( of: value) != nil
216
- } ) . map ( { $1 } )
217
- )
218
-
219
- result. append ( contentsOf:
220
- humanData. filter ( {
221
- return $1. name. lowercased ( ) . range ( of: value) != nil
222
- } ) . map ( { $1 } )
223
- )
224
-
225
- result. append ( contentsOf:
226
- droidData. filter ( {
227
- return $1. name. lowercased ( ) . range ( of: value) != nil
228
- } ) . map ( { $1 } )
229
- )
213
+ // Due to randomness of hash values introduced by https://github.com/apple/swift-evolution/blob/master/proposals/0206-hashable-enhancements.md
214
+ // we should iterate over sorted keys here otherwise the order of output is random and the tests sometimes fails.
215
+
216
+ planetData. keys. sorted ( ) . forEach {
217
+ if planetData [ $0] ? . name. lowercased ( ) . range ( of: value) != nil {
218
+ result. append ( planetData [ $0] !)
219
+ }
220
+ }
221
+
222
+ humanData. keys. sorted ( ) . forEach {
223
+ if humanData [ $0] ? . name. lowercased ( ) . range ( of: value) != nil {
224
+ result. append ( humanData [ $0] !)
225
+ }
226
+ }
227
+
228
+ droidData. keys. sorted ( ) . forEach {
229
+ if droidData [ $0] ? . name. lowercased ( ) . range ( of: value) != nil {
230
+ result. append ( droidData [ $0] !)
231
+ }
232
+ }
230
233
231
234
return result
232
235
}
Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ class StarWarsIntrospectionTests : XCTestCase {
18
18
" } " +
19
19
" } "
20
20
21
- #if os(macOS)
22
21
let expected : Map = [
23
22
" data " : [
24
23
" __schema " : [
@@ -81,70 +80,6 @@ class StarWarsIntrospectionTests : XCTestCase {
81
80
] ,
82
81
] ,
83
82
]
84
- #else
85
- let expected : Map = [
86
- " data " : [
87
- " __schema " : [
88
- " types " : [
89
- [
90
- " name " : " __Directive " ,
91
- ] ,
92
- [
93
- " name " : " __DirectiveLocation " ,
94
- ] ,
95
- [
96
- " name " : " __EnumValue " ,
97
- ] ,
98
- [
99
- " name " : " __Field " ,
100
- ] ,
101
- [
102
- " name " : " __InputValue " ,
103
- ] ,
104
- [
105
- " name " : " __Schema " ,
106
- ] ,
107
- [
108
- " name " : " __Type " ,
109
- ] ,
110
- [
111
- " name " : " __TypeKind " ,
112
- ] ,
113
- [
114
- " name " : " Boolean " ,
115
- ] ,
116
- [
117
- " name " : " Character " ,
118
- ] ,
119
- [
120
- " name " : " Droid " ,
121
- ] ,
122
- [
123
- " name " : " Episode " ,
124
- ] ,
125
- [
126
- " name " : " Human " ,
127
- ] ,
128
- [
129
- " name " : " Int " ,
130
- ] ,
131
- [
132
- " name " : " Planet " ,
133
- ] ,
134
- [
135
- " name " : " Query " ,
136
- ] ,
137
- [
138
- " name " : " SearchResult " ,
139
- ] ,
140
- [
141
- " name " : " String " ,
142
- ] ,
143
- ] ,
144
- ] ,
145
- ] ,
146
- ]
147
- #endif
148
83
149
84
let result = try starWarsSchema. execute ( request: query, eventLoopGroup: eventLoopGroup) . wait ( )
150
85
XCTAssertEqual ( result, expected)
Original file line number Diff line number Diff line change @@ -609,6 +609,7 @@ class StarWarsQueryTests : XCTestCase {
609
609
]
610
610
611
611
let result = try starWarsSchema. execute ( request: query, eventLoopGroup: eventLoopGroup) . wait ( )
612
+
612
613
XCTAssertEqual ( result, expected)
613
614
}
614
615
}
You can’t perform that action at this time.
0 commit comments