@@ -80,41 +80,19 @@ func TestPlatformSearch(t *testing.T) {
80
80
},
81
81
},
82
82
InstalledVersion : "" ,
83
- LatestVersion : "1.0.6" ,
84
83
})
85
84
})
86
85
87
86
t .Run ("SearchNoAllVersions" , func (t * testing.T ) {
87
+ // This platform doesn't contain any installable release
88
88
res , stat := PlatformSearch (& rpc.PlatformSearchRequest {
89
89
Instance : inst ,
90
90
SearchArgs : "retrokit" ,
91
91
AllVersions : false ,
92
92
})
93
93
require .Nil (t , stat )
94
94
require .NotNil (t , res )
95
- require .Len (t , res .SearchOutput , 1 )
96
- require .Contains (t , res .SearchOutput , & rpc.PlatformSummary {
97
- Metadata : & rpc.PlatformMetadata {
98
- Id : "Retrokits-RK002:arm" ,
99
- Maintainer : "Retrokits (www.retrokits.com)" ,
100
- Website : "https://www.retrokits.com" ,
101
-
102
- Indexed : true ,
103
- },
104
- Releases : map [string ]* rpc.PlatformRelease {
105
- "1.0.6" : {
106
- Name : "RK002" ,
107
- Type : []string {"Contributed" },
108
- Installed : false ,
109
- Version : "1.0.6" ,
110
- Boards : []* rpc.Board {{Name : "RK002" }},
111
- Help : & rpc.HelpResources {Online : "https://www.retrokits.com/rk002/arduino" },
112
- Compatible : false ,
113
- },
114
- },
115
- InstalledVersion : "" ,
116
- LatestVersion : "1.0.6" ,
117
- })
95
+ require .Empty (t , res .SearchOutput )
118
96
})
119
97
120
98
t .Run ("SearchThePackageMaintainer" , func (t * testing.T ) {
@@ -155,7 +133,6 @@ func TestPlatformSearch(t *testing.T) {
155
133
},
156
134
},
157
135
InstalledVersion : "" ,
158
- LatestVersion : "1.0.6" ,
159
136
})
160
137
})
161
138
@@ -197,7 +174,6 @@ func TestPlatformSearch(t *testing.T) {
197
174
},
198
175
},
199
176
InstalledVersion : "" ,
200
- LatestVersion : "1.0.6" ,
201
177
})
202
178
})
203
179
@@ -239,7 +215,6 @@ func TestPlatformSearch(t *testing.T) {
239
215
},
240
216
},
241
217
InstalledVersion : "" ,
242
- LatestVersion : "1.0.6" ,
243
218
})
244
219
})
245
220
@@ -299,7 +274,6 @@ func TestPlatformSearch(t *testing.T) {
299
274
},
300
275
},
301
276
InstalledVersion : "" ,
302
- LatestVersion : "1.8.3" ,
303
277
})
304
278
})
305
279
@@ -359,7 +333,6 @@ func TestPlatformSearch(t *testing.T) {
359
333
},
360
334
},
361
335
InstalledVersion : "" ,
362
- LatestVersion : "1.8.3" ,
363
336
})
364
337
})
365
338
}
@@ -383,15 +356,15 @@ func TestPlatformSearchSorting(t *testing.T) {
383
356
res , stat := PlatformSearch (& rpc.PlatformSearchRequest {
384
357
Instance : inst ,
385
358
SearchArgs : "" ,
386
- AllVersions : false ,
359
+ AllVersions : true ,
387
360
})
388
361
require .Nil (t , stat )
389
362
require .NotNil (t , res )
390
363
391
364
require .Len (t , res .SearchOutput , 3 )
392
- require .Equal (t , res .SearchOutput [0 ].GetLatestRelease () .Name , "Arduino AVR Boards" )
365
+ require .Equal (t , res .SearchOutput [0 ].GetSortedReleases ()[ 0 ] .Name , "Arduino AVR Boards" )
393
366
require .Equal (t , res .SearchOutput [0 ].Metadata .Deprecated , false )
394
- require .Equal (t , res .SearchOutput [1 ].GetLatestRelease () .Name , "RK002" )
367
+ require .Equal (t , res .SearchOutput [1 ].GetSortedReleases ()[ 0 ] .Name , "RK002" )
395
368
require .Equal (t , res .SearchOutput [1 ].Metadata .Deprecated , false )
396
369
require .Equal (t , res .SearchOutput [2 ].GetLatestRelease ().Name , "Platform" )
397
370
require .Equal (t , res .SearchOutput [2 ].Metadata .Deprecated , true )
0 commit comments