Skip to content

Commit 87be96e

Browse files
committed
Add tests for distribution updates
1 parent 4b3a4f9 commit 87be96e

File tree

2 files changed

+371
-7
lines changed

2 files changed

+371
-7
lines changed

extensions/ql-vscode/src/codeql-cli/distribution.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const NIGHTLY_DISTRIBUTION_REPOSITORY_NWO = "dsp-testing/codeql-cli-nightlies";
6767
*/
6868
export const DEFAULT_DISTRIBUTION_VERSION_RANGE: Range = new Range("2.x");
6969

70-
interface DistributionState {
70+
export interface DistributionState {
7171
folderIndex: number;
7272
release: Release | null;
7373
}
@@ -329,10 +329,11 @@ class ExtensionSpecificDistributionManager {
329329
// If the file doesn't exist, that just means we need to create it
330330

331331
this.distributionState = {
332-
folderIndex: this.extensionContext.globalState.get(
333-
"distributionFolderIndex",
334-
0,
335-
),
332+
folderIndex:
333+
this.extensionContext.globalState.get(
334+
"distributionFolderIndex",
335+
0,
336+
) ?? 0,
336337
release: (this.extensionContext.globalState.get(
337338
"distributionRelease",
338339
) ?? null) as Release | null,
@@ -647,7 +648,7 @@ class ExtensionSpecificDistributionManager {
647648
await this.updateState((oldState) => {
648649
return {
649650
...oldState,
650-
folderIndex: oldState.folderIndex + 1,
651+
folderIndex: (oldState.folderIndex ?? 0) + 1,
651652
};
652653
});
653654
}

0 commit comments

Comments
 (0)