Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 304ecf9

Browse filesBrowse files
author
Akos Kitta
committed
fix: platform release version ordering
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
1 parent 5a77ce2 commit 304ecf9
Copy full SHA for 304ecf9

File tree

2 files changed

+28
-2
lines changed
Filter options

2 files changed

+28
-2
lines changed

‎arduino-ide-extension/src/node/boards-service-impl.ts

Copy file name to clipboardExpand all lines: arduino-ide-extension/src/node/boards-service-impl.ts
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,9 @@ function createBoardsPackage(
589589
return undefined; // never show incompatible platforms
590590
}
591591
const { id, website, maintainer } = summary.metadata;
592+
const availableVersions = Array.from(versionReleaseMap.keys())
593+
.sort(Installable.Version.COMPARATOR)
594+
.reverse();
592595
return {
593596
id,
594597
name,
@@ -602,7 +605,7 @@ function createBoardsPackage(
602605
moreInfoLink: website,
603606
author: maintainer,
604607
deprecated,
605-
availableVersions: Array.from(versionReleaseMap.keys()),
608+
availableVersions,
606609
};
607610
}
608611

‎arduino-ide-extension/src/test/node/boards-service-impl.slow-test.ts

Copy file name to clipboardExpand all lines: arduino-ide-extension/src/test/node/boards-service-impl.slow-test.ts
+24-1Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { DisposableCollection } from '@theia/core/lib/common/disposable';
22
import { Container } from '@theia/core/shared/inversify';
33
import { expect } from 'chai';
4-
import { BoardSearch, BoardsService } from '../../common/protocol';
4+
import { BoardSearch, BoardsService, Installable } from '../../common/protocol';
55
import { createBaseContainer, startDaemon } from './node-test-bindings';
66

77
describe('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

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.