Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
adelkahomolova committed Oct 21, 2019
1 parent c229212 commit 81fc734
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 29 deletions.
10 changes: 5 additions & 5 deletions src/detectors/ScanningStrategyDetector.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('ScanningStrategyDetector', () => {

it('local path with remote public GitHub', async () => {
const repoPath = 'git@github.com:DXHeroes/dx-scanner.git';
new GitHubNock(1, 'DXHeroes', 1, 'dx-scanner').getRepo('').reply(200);
new GitHubNock('1', 'DXHeroes', 1, 'dx-scanner').getRepo('').reply(200);

mockedGit.mockImplementation(() => {
return {
Expand All @@ -56,7 +56,7 @@ describe('ScanningStrategyDetector', () => {

it('local path with remote private GitHub', async () => {
const repoPath = 'git@github.com:DXHeroes/dx-scanner-private.git';
new GitHubNock(1, 'DXHeroes', 1, 'dx-scanner-private').getRepo('').reply(404);
new GitHubNock('1', 'DXHeroes', 1, 'dx-scanner-private').getRepo('').reply(404);

mockedGit.mockImplementation(() => {
return {
Expand All @@ -72,7 +72,7 @@ describe('ScanningStrategyDetector', () => {

it('remote public GitHub', async () => {
const repoPath = 'https://github.com/DXHeroes/dx-scanner.git';
new GitHubNock(1, 'DXHeroes', 1, 'dx-scanner').getRepo('').reply(200);
new GitHubNock('1', 'DXHeroes', 1, 'dx-scanner').getRepo('').reply(200);
const container = createTestContainer({ uri: repoPath });

const result = await container.scanningStrategyDetector.detect();
Expand All @@ -87,15 +87,15 @@ describe('ScanningStrategyDetector', () => {

it('remote private GitHub', async () => {
const repoPath = 'https://github.com/DXHeroes/dx-scanner-private.git';
new GitHubNock(1, 'DXHeroes', 1, 'dx-scanner-private').getRepo('').reply(404);
new GitHubNock('1', 'DXHeroes', 1, 'dx-scanner-private').getRepo('').reply(404);
const container = createTestContainer({ uri: repoPath, auth: 'bad AT' });

await expect(container.scanningStrategyDetector.detect()).rejects.toThrow('bad credentials');
});

it('remote public GitHub without protocol in the URL', async () => {
const repoPath = 'github.com/DXHeroes/dx-scanner.git';
new GitHubNock(1, 'DXHeroes', 1, 'dx-scanner').getRepo('').reply(200);
new GitHubNock('1', 'DXHeroes', 1, 'dx-scanner').getRepo('').reply(200);
const container = createTestContainer({ uri: repoPath });

const result = await container.scanningStrategyDetector.detect();
Expand Down
4 changes: 2 additions & 2 deletions src/services/git/Git.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('Git', () => {
beforeAll(() => {
service = new GitHubService({ uri: '.' });
git = new Git({ url: 'https://github.com/DXHeroes/dx-scanner.git' }, service);
gitHubNock = new GitHubNock(1, 'DXHeroes', 1, 'dx-scanner');
gitHubNock = new GitHubNock('1', 'DXHeroes', 1, 'dx-scanner');
});

beforeEach(() => {
Expand Down Expand Up @@ -278,7 +278,7 @@ describe('Git', () => {

describe('#getContributorCount', () => {
it('returns the number of contributors', async () => {
gitHubNock.getContributors([{ id: 251370, login: 'Spaceghost' }, { id: 583231, login: 'octocat' }]);
gitHubNock.getContributors([{ id: '251370', login: 'Spaceghost' }, { id: '583231', login: 'octocat' }]);

const result = await git.getContributorCount();
expect(result).toEqual(2);
Expand Down
4 changes: 2 additions & 2 deletions src/services/git/GitHubService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class GitHubService implements ICVSService {
repo: {
url: val.base.repo.url,
name: val.base.repo.name,
id: val.base.repo.id,
id: val.base.repo.id.toString(),
owner: { url: val.base.repo.owner.url, id: val.base.repo.owner.id.toString(), login: val.base.repo.owner.login },
},
},
Expand Down Expand Up @@ -128,7 +128,7 @@ export class GitHubService implements ICVSService {
repo: {
url: response.data.base.repo.url,
name: response.data.base.repo.name,
id: response.data.base.repo.id,
id: response.data.base.repo.id.toString(),
owner: {
url: response.data.base.repo.owner.url,
id: response.data.base.repo.owner.id.toString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ export const getContributorsStatsResponse = [
c: 0,
},
],
author: new UserItem(251370, 'Spaceghost'),
author: new UserItem("251370", 'Spaceghost'),
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const getIssueCommentsResponse = [
issue_url: 'https://api.github.com/repos/octocat/Hello-World/issues/1',
id: 1340258,
node_id: 'MDEyOklzc3VlQ29tbWVudDEzNDAyNTg=',
user: new UserItem(841296, 'masonzou'),
user: new UserItem('841296', 'masonzou'),
created_at: '2011-06-10T07:30:27Z',
updated_at: '2011-06-10T07:30:27Z',
author_association: 'NONE',
Expand All @@ -20,7 +20,7 @@ export const getIssueCommentsResponse = [
issue_url: 'https://api.github.com/repos/octocat/Hello-World/issues/1',
id: 13725928,
node_id: 'MDEyOklzc3VlQ29tbWVudDEzNzI1OTI4',
user: new UserItem(3627156, '198103292005021004'),
user: new UserItem('3627156', '198103292005021004'),
created_at: '2013-02-18T15:09:23Z',
updated_at: '2013-02-18T15:09:23Z',
author_association: 'NONE',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const getIssueResponse = {
node_id: 'MDExOlB1bGxSZXF1ZXN0MTQwOTAw',
number: 1,
title: 'Edited README via GitHub',
user: new UserItem(777449, 'unoju'),
user: new UserItem('777449', 'unoju'),
labels: [],
state: 'closed',
locked: false,
Expand All @@ -31,5 +31,5 @@ export const getIssueResponse = {
patch_url: 'https://github.com/octocat/Hello-World/pull/1.patch',
},
body: '',
closed_by: new UserItem(583231, 'octocat'),
closed_by: new UserItem('583231', 'octocat'),
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const getIssuesResponse = [
node_id: 'MDExOlB1bGxSZXF1ZXN0MjkyMDM3MTY4',
number: 513,
title: 'a',
user: new UserItem(33818943, 'nowaygod'),
user: new UserItem('33818943', 'nowaygod'),
labels: [],
state: 'open',
locked: false,
Expand Down Expand Up @@ -48,7 +48,7 @@ export const getIssuesResponse = [
node_id: 'MDExOlB1bGxSZXF1ZXN0MjkxMjY5ODMy',
number: 512,
title: 'Update README',
user: new UserItem(50170747, 'nmonmontmon'),
user: new UserItem('50170747', 'nmonmontmon'),
labels: [],
state: 'open',
locked: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const getPullRequestsReviewsResponse = [
{
id: 41231978,
node_id: 'MDE3OlB1bGxSZXF1ZXN0UmV2aWV3NDEyMzE5Nzg=',
user: new UserItem(1999050, 'pedrorijo91'),
user: new UserItem("1999050", 'pedrorijo91'),
body: '',
state: 'COMMENTED',
html_url: 'https://github.com/octocat/Hello-World/pull/1#pullrequestreview-41231978',
Expand All @@ -25,7 +25,7 @@ export const getPullRequestsReviewsResponse = [
{
id: 134751616,
node_id: 'MDE3OlB1bGxSZXF1ZXN0UmV2aWV3MTM0NzUxNjE2',
user: new UserItem(13119311, 'alexanderclin'),
user: new UserItem("13119311", 'alexanderclin'),
body: '',
state: 'COMMENTED',
html_url: 'https://github.com/octocat/Hello-World/pull/1#pullrequestreview-134751616',
Expand All @@ -45,7 +45,7 @@ export const getPullRequestsReviewsResponse = [
{
id: 134757534,
node_id: 'MDE3OlB1bGxSZXF1ZXN0UmV2aWV3MTM0NzU3NTM0',
user: new UserItem(19191220, 'jonathantsang'),
user: new UserItem("19191220", 'jonathantsang'),
body: '',
state: 'COMMENTED',
html_url: 'https://github.com/octocat/Hello-World/pull/1#pullrequestreview-134757534',
Expand All @@ -65,7 +65,7 @@ export const getPullRequestsReviewsResponse = [
{
id: 135027960,
node_id: 'MDE3OlB1bGxSZXF1ZXN0UmV2aWV3MTM1MDI3OTYw',
user: new UserItem(19191220, 'jonathantsang'),
user: new UserItem("19191220", 'jonathantsang'),
body: '',
state: 'COMMENTED',
html_url: 'https://github.com/octocat/Hello-World/pull/1#pullrequestreview-135027960',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { PullRequest } from '../../model';
export const getPullServiceResponse: PullRequest = {
base: {
repo: {
id: 1296269,
id: '1296269',
name: 'Hello-World',
owner: {
id: '583231',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export const getPullCommitsResponse = [
url: 'https://api.github.com/repos/octocat/Hello-World/commits/7044a8a032e85b6ab611033b2ac8af7ce85805b2',
html_url: 'https://github.com/octocat/Hello-World/commit/7044a8a032e85b6ab611033b2ac8af7ce85805b2',
comments_url: 'https://api.github.com/repos/octocat/Hello-World/commits/7044a8a032e85b6ab611033b2ac8af7ce85805b2/comments',
author: new UserItem(777449, 'unoju'),
committer: new UserItem(777449, 'unoju'),
author: new UserItem('777449', 'unoju'),
committer: new UserItem('777449', 'unoju'),
parents: [
{
sha: '553c2077f0edc3d5dc5d17262f6aa498e69d6f8e',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const getPullsServiceResponse: Paginated<PullRequest> = {
{
base: {
repo: {
id: 1296269,
id: '1296269',
name: 'Hello-World',
owner: {
id: '1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export const getRepoCommitsResponse = [
url: 'https://api.github.com/repos/octocat/Hello-World/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d',
html_url: 'https://github.com/octocat/Hello-World/commit/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d',
comments_url: 'https://api.github.com/repos/octocat/Hello-World/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d/comments',
author: new UserItem(583231, 'octocat'),
committer: new UserItem(583231, 'octocat'),
author: new UserItem("583231", 'octocat'),
committer: new UserItem("583231", 'octocat'),
parents: [
{
sha: '553c2077f0edc3d5dc5d17262f6aa498e69d6f8e',
Expand Down Expand Up @@ -79,8 +79,8 @@ export const getRepoCommitsResponse = [
url: 'https://api.github.com/repos/octocat/Hello-World/commits/762941318ee16e59dabbacb1b4049eec22f0d303',
html_url: 'https://github.com/octocat/Hello-World/commit/762941318ee16e59dabbacb1b4049eec22f0d303',
comments_url: 'https://api.github.com/repos/octocat/Hello-World/commits/762941318ee16e59dabbacb1b4049eec22f0d303/comments',
author: new UserItem(251370, 'Spaceghost'),
committer: new UserItem(251370, 'Spaceghost'),
author: new UserItem("251370", 'Spaceghost'),
committer: new UserItem("251370", 'Spaceghost'),
parents: [
{
sha: '553c2077f0edc3d5dc5d17262f6aa498e69d6f8e',
Expand Down
2 changes: 1 addition & 1 deletion src/services/git/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ interface Tree {

interface Repo {
url: string;
id: number | string;
id: string;
name: string;
owner: UserInfo;
}

0 comments on commit 81fc734

Please sign in to comment.