Skip to content

Commit

Permalink
fix: tests after refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
adelkahomolova committed Dec 16, 2019
1 parent 548f469 commit a6f465c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
8 changes: 5 additions & 3 deletions src/inspectors/CollaborationInspector.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ describe('Collaboration Inspector', () => {
});

it('returns paginated pull requests', async () => {
new GitHubNock('1', 'octocat', 1296269, 'Hello-World').getPulls([
{ number: 1347, state: 'open', title: 'new-feature', body: 'Please pull these awesome changes', head: 'new-topic', base: 'master' },
]);
new GitHubNock('1', 'octocat', 1296269, 'Hello-World').getPulls({
pulls: [
{ number: 1347, state: 'open', title: 'new-feature', body: 'Please pull these awesome changes', head: 'new-topic', base: 'master' },
],
});

const response = await inspector.getPullRequests('octocat', 'Hello-World');
expect(response).toMatchObject(getPullsServiceResponse);
Expand Down
20 changes: 11 additions & 9 deletions src/practices/LanguageIndependent/DoesPullRequests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ describe('DoesPullRequests', () => {

it('return practicing if there is at least one PR which is newer than last commit in master minus 30 days', async () => {
containerCtx.practiceContext.projectComponent.repositoryPath = 'https://github.com/octocat/Hello-World';
new GitHubNock('1', 'octocat', 1296269, 'Hello-World').getPulls(
[{ number: 1347, state: 'open', title: 'new-feature', body: 'Please pull these awesome changes', head: 'new-topic', base: 'master' }],
PullRequestState.all,
);
new GitHubNock('1', 'octocat', 1296269, 'Hello-World').getPulls({
pulls: [
{ number: 1347, state: 'open', title: 'new-feature', body: 'Please pull these awesome changes', head: 'new-topic', base: 'master' },
],
queryState: PullRequestState.all,
});
new GitHubNock('1', 'octocat', 1, 'Hello-World').getCommits().reply(200, getRepoCommitsResponse);

const evaluated = await practice.evaluate(containerCtx.practiceContext);
Expand All @@ -39,7 +41,7 @@ describe('DoesPullRequests', () => {

it('return notPracticing if there is no PR which is newer than last commit in master minus 30 days', async () => {
containerCtx.practiceContext.projectComponent.repositoryPath = 'https://github.com/octocat/Hello-World';
new GitHubNock('1', 'octocat', 1296269, 'Hello-World').getPulls([], PullRequestState.all);
new GitHubNock('1', 'octocat', 1296269, 'Hello-World').getPulls({ pulls: [], queryState: PullRequestState.all });
new GitHubNock('1', 'octocat', 1, 'Hello-World').getCommits().reply(200, getRepoCommitsResponse);

const evaluated = await practice.evaluate(containerCtx.practiceContext);
Expand All @@ -48,8 +50,8 @@ describe('DoesPullRequests', () => {

it('return notPracticing if there is PR older than 30 days than the last commit in master', async () => {
containerCtx.practiceContext.projectComponent.repositoryPath = 'https://github.com/octocat/Hello-World';
new GitHubNock('1', 'octocat', 1296269, 'Hello-World').getPulls(
[
new GitHubNock('1', 'octocat', 1296269, 'Hello-World').getPulls({
pulls: [
{
number: 1348,
state: 'opened',
Expand All @@ -61,8 +63,8 @@ describe('DoesPullRequests', () => {
created_at: '2000-03-06T23:06:50Z',
},
],
PullRequestState.all,
);
queryState: PullRequestState.all,
});
new GitHubNock('1', 'octocat', 1, 'Hello-World').getCommits().reply(200, getRepoCommitsResponse);

const evaluated = await practice.evaluate(containerCtx.practiceContext);
Expand Down
8 changes: 4 additions & 4 deletions src/services/git/Git.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,13 @@ describe('Git', () => {

describe('#getPullRequestCount', () => {
it('returns the number of both open and closed pull requests', async () => {
gitHubNock.getPulls(
[
gitHubNock.getPulls({
pulls: [
{ number: 1, state: 'open', title: '1', body: '1', head: 'head', base: 'base' },
{ number: 2, state: 'closed', title: '2', body: '2', head: 'head', base: 'base' },
],
'all',
);
queryState: 'all',
});

const result = await git.getPullRequestCount();
expect(result).toEqual(2);
Expand Down

0 comments on commit a6f465c

Please sign in to comment.