11import { DisposableCollection } from '@theia/core/lib/common/disposable' ;
22import { Container } from '@theia/core/shared/inversify' ;
33import { expect } from 'chai' ;
4- import { BoardSearch , BoardsService } from '../../common/protocol' ;
4+ import { BoardSearch , BoardsService , Installable } from '../../common/protocol' ;
55import { createBaseContainer , startDaemon } from './node-test-bindings' ;
66
77describe ( 'boards-service-impl' , ( ) => {
@@ -24,6 +24,29 @@ describe('boards-service-impl', () => {
2424 expect ( result ) . is . not . empty ;
2525 } ) ;
2626
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+
2750 it ( "should boost a result when 'types' includes 'arduino', and lower the score if deprecated" , async ( ) => {
2851 const result = await boardService . search ( { } ) ;
2952 const arduinoIndexes : number [ ] = [ ] ;
0 commit comments