Skip to content

Commit

Permalink
test: added a unit test to validate LCE url is baseURL
Browse files Browse the repository at this point in the history
  • Loading branch information
metju90 committed Jan 26, 2022
1 parent 9cd65c6 commit 5aeeb19
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/jest/unit/snyk-code/snyk-code-test.spec.ts
Expand Up @@ -521,6 +521,33 @@ describe('Test snyk code', () => {
},
);

it('Local Code Engine - Always calls code-client with url coming from sastSettings', async () => {
const sastSettings = {
sastEnabled: true,
localCodeEngine: {
url: 'http://lce:31111/api',
allowCloudUpload: false,
enabled: true,
},
};

const analyzeFoldersSpy = analyzeFoldersMock.mockResolvedValue(
sampleAnalyzeFoldersResponse,
);
await getCodeAnalysisAndParseResults(
'.',
{
path: '',
code: true,
},
sastSettings,
);

expect(analyzeFoldersSpy.mock.calls[0][0].connection.baseURL).toBe(
'http://lce:31111/api',
);
});

it('Local code engine - should throw error, when enabled and url is missing', async () => {
const sastSettings = {
sastEnabled: true,
Expand Down

0 comments on commit 5aeeb19

Please sign in to comment.