forked from jfrog/jfrog-vscode-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
src/test/tests/integration/externalResourcesRepository.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { assert } from 'chai'; | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
|
||
import { AnalyzeScanRequest } from '../../../main/scanLogic/scanRunners/analyzerModels'; | ||
import { SecretsRunner, SecretsScanResponse } from '../../../main/scanLogic/scanRunners/secretsScan'; | ||
import { | ||
AnalyzerManagerIntegrationEnv, | ||
} from '../utils/testIntegration.test'; | ||
import { Configuration } from '../../../main/utils/configuration'; | ||
|
||
describe.only('External Resources Repository Integration Tests', async () => { | ||
const integrationManager: AnalyzerManagerIntegrationEnv = new AnalyzerManagerIntegrationEnv(); | ||
const testDataRoot: string = path.join(__dirname, '..', '..', 'resources', 'secretsScan'); | ||
|
||
let runner: SecretsRunner; | ||
let response: SecretsScanResponse; | ||
let expectedContent: SecretsScanResponse; | ||
|
||
before(async function () { | ||
process.env[Configuration.JFROG_IDE_RELEASES_REPO] = 'releases-proxy'; | ||
|
||
// Integration initialization | ||
await integrationManager.initialize(testDataRoot); | ||
runner = integrationManager.entitledJasRunnerFactory.createSecretsRunners()[0]; | ||
|
||
// Get expected partial result that the scan should contain | ||
let dataPath: string = path.join(testDataRoot, 'expectedScanResponse.json'); | ||
expectedContent = JSON.parse(fs.readFileSync(dataPath, 'utf8').toString()); | ||
assert.isDefined(expectedContent, 'Failed to read expected SecretsScanResponse content from ' + dataPath); | ||
response = await runner | ||
.executeRequest(() => undefined, { roots: [testDataRoot] } as AnalyzeScanRequest) | ||
.then(runResult => runner.convertResponse(runResult)); | ||
}); | ||
after(() => { | ||
delete process.env[Configuration.JFROG_IDE_RELEASES_REPO]; | ||
}); | ||
it('Check response defined', () => { | ||
assert.isDefined(response); | ||
}); | ||
}); |