Skip to content

Commit

Permalink
Add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
Or-Geva committed Nov 3, 2023
1 parent e593b3e commit e0953ef
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/test/tests/integration/externalResourcesRepository.test.ts
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);
});
});

0 comments on commit e0953ef

Please sign in to comment.