Make isVariantAnalysisRepoDownloaded public

This commit is contained in:
Robert
2022-10-27 17:04:26 +01:00
parent 51589e953e
commit caeaba2f2f
2 changed files with 20 additions and 1 deletions

View File

@@ -146,7 +146,7 @@ export class VariantAnalysisResultsManager extends DisposableObject {
throw new Error('Missing results file');
}
private async isVariantAnalysisRepoDownloaded(
public async isVariantAnalysisRepoDownloaded(
variantAnalysisStoragePath: string,
repositoryFullName: string,
): Promise<boolean> {

View File

@@ -66,6 +66,12 @@ describe(VariantAnalysisResultsManager.name, function() {
fs.rmSync(variantAnalysisStoragePath, { recursive: true });
});
describe('isVariantAnalysisRepoDownloaded', () => {
it('should return false when no results are downloaded', async () => {
expect(await variantAnalysisResultsManager.isVariantAnalysisRepoDownloaded(variantAnalysisStoragePath, dummyRepoTask.repository.full_name)).to.equal(false);
});
});
describe('when the artifact_url is missing', async () => {
it('should not try to download the result', async () => {
const dummyRepoTask = createMockVariantAnalysisRepoTask();
@@ -131,6 +137,19 @@ describe(VariantAnalysisResultsManager.name, function() {
expect(fs.existsSync(`${repoTaskStorageDirectory}/results/results.sarif`)).to.be.true;
});
describe('isVariantAnalysisRepoDownloaded', () => {
it('should return true once results are downloaded', async () => {
await variantAnalysisResultsManager.download(
mockCredentials,
variantAnalysisId,
dummyRepoTask,
variantAnalysisStoragePath
);
expect(await variantAnalysisResultsManager.isVariantAnalysisRepoDownloaded(variantAnalysisStoragePath, dummyRepoTask.repository.full_name)).to.equal(true);
});
});
});
});
});