Skip to content

Commit caeaba2

Browse files
Make isVariantAnalysisRepoDownloaded public
1 parent 51589e9 commit caeaba2

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

extensions/ql-vscode/src/remote-queries/variant-analysis-results-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export class VariantAnalysisResultsManager extends DisposableObject {
146146
throw new Error('Missing results file');
147147
}
148148

149-
private async isVariantAnalysisRepoDownloaded(
149+
public async isVariantAnalysisRepoDownloaded(
150150
variantAnalysisStoragePath: string,
151151
repositoryFullName: string,
152152
): Promise<boolean> {

extensions/ql-vscode/src/vscode-tests/cli-integration/remote-queries/variant-analysis-results-manager.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ describe(VariantAnalysisResultsManager.name, function() {
6666
fs.rmSync(variantAnalysisStoragePath, { recursive: true });
6767
});
6868

69+
describe('isVariantAnalysisRepoDownloaded', () => {
70+
it('should return false when no results are downloaded', async () => {
71+
expect(await variantAnalysisResultsManager.isVariantAnalysisRepoDownloaded(variantAnalysisStoragePath, dummyRepoTask.repository.full_name)).to.equal(false);
72+
});
73+
});
74+
6975
describe('when the artifact_url is missing', async () => {
7076
it('should not try to download the result', async () => {
7177
const dummyRepoTask = createMockVariantAnalysisRepoTask();
@@ -131,6 +137,19 @@ describe(VariantAnalysisResultsManager.name, function() {
131137

132138
expect(fs.existsSync(`${repoTaskStorageDirectory}/results/results.sarif`)).to.be.true;
133139
});
140+
141+
describe('isVariantAnalysisRepoDownloaded', () => {
142+
it('should return true once results are downloaded', async () => {
143+
await variantAnalysisResultsManager.download(
144+
mockCredentials,
145+
variantAnalysisId,
146+
dummyRepoTask,
147+
variantAnalysisStoragePath
148+
);
149+
150+
expect(await variantAnalysisResultsManager.isVariantAnalysisRepoDownloaded(variantAnalysisStoragePath, dummyRepoTask.repository.full_name)).to.equal(true);
151+
});
152+
});
134153
});
135154
});
136155
});

0 commit comments

Comments
 (0)