Skip to content

Commit

Permalink
fix: rebind IContentRepositoryBrowser in practice instead of binding …
Browse files Browse the repository at this point in the history
…in inversify.config.ts
  • Loading branch information
adelkahomolova committed Dec 9, 2019
1 parent af50b8d commit 1141cad
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/inspectors/CollaborationInspector.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ describe('Collaboration Inspector', () => {
let containerCtx: TestContainerContext;

beforeAll(async () => {
const args = { uri: 'https://github.com/octocat/Hello-World' };
containerCtx = createTestContainer(args);
containerCtx = createTestContainer();
inspector = <CollaborationInspector>containerCtx.practiceContext.collaborationInspector;
});

Expand Down
3 changes: 1 addition & 2 deletions src/inspectors/IssueTrackingInspector.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ describe('Issue Tracking Inspector', () => {
let containerCtx: TestContainerContext;

beforeAll(async () => {
const args = { uri: 'https://github.com/octocat/Hello-World' };
containerCtx = createTestContainer(args);
containerCtx = createTestContainer();
inspector = <IssueTrackingInspector>containerCtx.practiceContext.issueTrackingInspector;
});

Expand Down
4 changes: 1 addition & 3 deletions src/inversify.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ export const createTestContainer = (

// FileSystemService as default ProjectBrowser
container.bind(Types.IProjectFilesBrowser).toConstantValue(vfss);
args?.uri.includes('github')
? container.bind(Types.IContentRepositoryBrowser).to(GitHubService)
: container.bind(Types.IContentRepositoryBrowser).to(BitbucketService);
container.bind(Types.IContentRepositoryBrowser).to(GitHubService);
container.bind(Types.IFileInspector).to(FileInspector);
container.bind(Types.IPackageInspector).to(JavaScriptPackageInspector);
container.bind(Types.ICollaborationInspector).to(CollaborationInspector);
Expand Down
3 changes: 1 addition & 2 deletions src/practices/LanguageIndependent/DoesPullRequests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ describe('DoesPullRequests', () => {
});

beforeAll(() => {
const args = { uri: 'https://github.com/octocat/Hello-World' };
containerCtx = createTestContainer(args);
containerCtx = createTestContainer();
containerCtx.container.bind('DoesPullRequests').to(DoesPullRequestsPractice);
practice = containerCtx.container.get('DoesPullRequests');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import nock from 'nock';
import { CollaborationInspector } from '../../inspectors';
import { createTestContainer, TestContainerContext } from '../../inversify.config';
import { PracticeEvaluationResult } from '../../model';
import { BitbucketPullRequestState } from '../../services';
import { BitbucketPullRequestState, BitbucketService } from '../../services';
import { BitbucketNock } from '../../test/helpers/bitbucketNock';
import { TimeToSolvePullRequestsPractice } from './TimeToSolvePullRequestsPractice';
import { Types } from '../../types';

describe('TimeToSolvePullRequestsPractice', () => {
let practice: TimeToSolvePullRequestsPractice;
Expand All @@ -20,9 +21,9 @@ describe('TimeToSolvePullRequestsPractice', () => {
});

beforeAll(() => {
const args = { uri: 'https://bitbucket.org/pypy/pypy' };
containerCtx = createTestContainer(args);
containerCtx = createTestContainer();
containerCtx.container.bind('TimeToSolvePractice').to(TimeToSolvePullRequestsPractice);
containerCtx.container.rebind(Types.IContentRepositoryBrowser).to(BitbucketService);
practice = containerCtx.container.get('TimeToSolvePractice');
mockCollaborationInspector = new MockedCollaborationInspector();
});
Expand Down

0 comments on commit 1141cad

Please sign in to comment.