1
1
import { DisposableCollection } from '@theia/core/lib/common/disposable' ;
2
2
import { Container } from '@theia/core/shared/inversify' ;
3
3
import { expect } from 'chai' ;
4
- import { BoardSearch , BoardsService } from '../../common/protocol' ;
4
+ import { BoardSearch , BoardsService , Installable } from '../../common/protocol' ;
5
5
import { createBaseContainer , startDaemon } from './node-test-bindings' ;
6
6
7
7
describe ( 'boards-service-impl' , ( ) => {
@@ -24,6 +24,29 @@ describe('boards-service-impl', () => {
24
24
expect ( result ) . is . not . empty ;
25
25
} ) ;
26
26
27
+ it ( 'should order the available platform release versions in descending order' , async function ( ) {
28
+ const result = await boardService . search ( { } ) ;
29
+ result . forEach ( ( platform ) =>
30
+ platform . availableVersions . forEach (
31
+ ( currentVersion , index , versions ) => {
32
+ if ( index < versions . length - 2 ) {
33
+ const nextArrayElement = versions [ index + 1 ] ;
34
+ const actual = Installable . Version . COMPARATOR (
35
+ currentVersion ,
36
+ nextArrayElement
37
+ ) ;
38
+ expect ( actual ) . to . be . greaterThan (
39
+ 0 ,
40
+ `Expected '${ currentVersion } ' to be gt '${ nextArrayElement } '. All versions: ${ JSON . stringify (
41
+ versions
42
+ ) } `
43
+ ) ;
44
+ }
45
+ }
46
+ )
47
+ ) ;
48
+ } ) ;
49
+
27
50
it ( "should boost a result when 'types' includes 'arduino', and lower the score if deprecated" , async ( ) => {
28
51
const result = await boardService . search ( { } ) ;
29
52
const arduinoIndexes : number [ ] = [ ] ;
0 commit comments