fix check isSignificantPullRequest
This commit is contained in:
Родитель
6ce5e14726
Коммит
7e64038760
|
@ -249,10 +249,10 @@ class ClaService {
|
|||
}
|
||||
token = token || item.token // in case this method is called via controller/default.js check -> api/cla.js validatePullRequest -> services/cla.js isCLARequired there is no user token
|
||||
const pullRequest = await this._getPR(owner, repo, number, token, true)
|
||||
if (typeof item.minFileChanges === 'number' && pullRequest.changed_files >= item.minFileChanges) {
|
||||
if (typeof item.minFileChanges === 'number' && pullRequest.data.changed_files >= item.minFileChanges) {
|
||||
return true
|
||||
}
|
||||
if (typeof item.minCodeChanges === 'number' && pullRequest.additions + pullRequest.deletions >= item.minCodeChanges) {
|
||||
if (typeof item.minCodeChanges === 'number' && pullRequest.data.additions + pullRequest.data.deletions >= item.minCodeChanges) {
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
@ -1585,9 +1585,7 @@ describe('cla:isClaRequired', () => {
|
|||
|
||||
it('should require a CLA when pull request exceed minimum file changes', async () => {
|
||||
testRes.repoServiceGet.minFileChanges = 2
|
||||
testRes.getPR = {
|
||||
changed_files: 2,
|
||||
}
|
||||
testRes.getPR = { data: { changed_files: 2 } }
|
||||
|
||||
const claIsRequired = await cla.isClaRequired(args)
|
||||
|
||||
|
@ -1602,9 +1600,11 @@ describe('cla:isClaRequired', () => {
|
|||
it('should require a CLA when pull request exceed minimum code changes', async () => {
|
||||
testRes.repoServiceGet.minCodeChanges = 15
|
||||
testRes.getPR = {
|
||||
data: {
|
||||
deletions: 10,
|
||||
additions: 10,
|
||||
}
|
||||
}
|
||||
|
||||
const claIsRequired = await cla.isClaRequired(args)
|
||||
|
||||
|
@ -1620,10 +1620,12 @@ describe('cla:isClaRequired', () => {
|
|||
testRes.repoServiceGet.minFileChanges = 2
|
||||
testRes.repoServiceGet.minCodeChanges = 15
|
||||
testRes.getPR = {
|
||||
data: {
|
||||
changed_files: 1,
|
||||
deletions: 7,
|
||||
additions: 7
|
||||
}
|
||||
}
|
||||
|
||||
const claIsRequired = await cla.isClaRequired(args)
|
||||
|
||||
|
@ -1643,10 +1645,12 @@ describe('cla:isClaRequired', () => {
|
|||
delete args.token
|
||||
testRes.repoServiceGet.minCodeChanges = 15
|
||||
testRes.getPR = {
|
||||
data: {
|
||||
changed_files: 1,
|
||||
additions: 14,
|
||||
deletions: 1
|
||||
}
|
||||
}
|
||||
|
||||
const claIsRequired = await cla.isClaRequired(args)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче