Skip to content

Commit

Permalink
fix: scanningDetector tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vlasy committed Jan 6, 2020
1 parent b0ef8fd commit d3cd41b
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/detectors/ScanningStrategyDetector.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe('ScanningStrategyDetector', () => {
const result = await container.scanningStrategyDetector.detect();

expect(result).toEqual({
accessType: undefined,
accessType: 'public',
localPath: '/local/path',
remoteUrl: repoPath,
serviceType: ServiceType.github,
Expand All @@ -88,8 +88,14 @@ describe('ScanningStrategyDetector', () => {
});

const container = createTestContainer({ uri: '/local/path', auth: 'bad AT' });
const result = await container.scanningStrategyDetector.detect();

await expect(container.scanningStrategyDetector.detect()).rejects.toThrow('bad credentials');
expect(result).toEqual({
accessType: AccessType.unknown,
localPath: '/local/path',
remoteUrl: repoPath,
serviceType: ServiceType.github,
});
});

it('remote public GitHub', async () => {
Expand All @@ -111,8 +117,14 @@ describe('ScanningStrategyDetector', () => {
const repoPath = 'https://github.com/DXHeroes/dx-scanner-private.git';
new GitHubNock('1', 'DXHeroes', 1, 'dx-scanner-private').getRepo('').reply(404);
const container = createTestContainer({ uri: repoPath, auth: 'bad AT' });
const result = await container.scanningStrategyDetector.detect();

await expect(container.scanningStrategyDetector.detect()).rejects.toThrow('bad credentials');
expect(result).toEqual({
accessType: AccessType.unknown,
localPath: undefined,
remoteUrl: repoPath,
serviceType: ServiceType.github,
});
});

it('remote public GitHub without protocol in the URL', async () => {
Expand Down

0 comments on commit d3cd41b

Please sign in to comment.