diff --git a/lib/modules/content-files.js b/lib/modules/content-files.js index ab3ce9c4..4c969059 100644 --- a/lib/modules/content-files.js +++ b/lib/modules/content-files.js @@ -23,9 +23,9 @@ class ContentFiles { async fetch(config) { const options = config.get(); - if (options.files.length > 15) { + if (options.files.length > 25) { throw new AllContributorBotError( - `Your .all-contributorsrc cannot contain more than 15 files.` + `Your .all-contributorsrc cannot contain more than 25 files.` ); } this.contentFilesByPath = await this.repository.getMultipleFiles( diff --git a/test/fixtures/repos.getContents.all-contributorsrc-16-files.json b/test/fixtures/repos.getContents.all-contributorsrc-26-files.json similarity index 84% rename from test/fixtures/repos.getContents.all-contributorsrc-16-files.json rename to test/fixtures/repos.getContents.all-contributorsrc-26-files.json index 56965bf9..6ff64db5 100644 --- a/test/fixtures/repos.getContents.all-contributorsrc-16-files.json +++ b/test/fixtures/repos.getContents.all-contributorsrc-26-files.json @@ -2,13 +2,13 @@ "name": ".all-contributorsrc", "path": ".all-contributorsrc", "sha": "dff34f715bca51114c0336a49381456a926806d5", - "size": 292, + "size": 464, "url": "https://api.github.com/repos/all-contributors/all-contributors-bot/contents/.all-contributorsrc?ref=master", "html_url": "https://github.com/all-contributors/all-contributors-bot/blob/master/.all-contributorsrc", "git_url": "https://api.github.com/repos/all-contributors/all-contributors-bot/git/blobs/dff34f715bca51114c0336a49381456a926806d5", "download_url": "https://raw.githubusercontent.com/all-contributors/all-contributors-bot/master/.all-contributorsrc", "type": "file", - "content": "ewogICJmaWxlcyI6IFsKICAgICIxLm1kIiwKICAgICIyLm1kIiwKICAgICIzLm1kIiwKICAgICI0Lm1kIiwKICAgICI1Lm1kIiwKICAgICI2Lm1kIiwKICAgICI3Lm1kIiwKICAgICI4Lm1kIiwKICAgICI5Lm1kIiwKICAgICIxMC5tZCIsCiAgICAiMTEubWQiLAogICAgIjEyLm1kIiwKICAgICIxMy5tZCIsCiAgICAiMTQubWQiLAogICAgIjE1Lm1kIiwKICAgICIxNi5tZCIKICBdCn0=", + "content": "ewogICJmaWxlcyI6IFsKICAgICIxLm1kIiwKICAgICIyLm1kIiwKICAgICIzLm1kIiwKICAgICI0Lm1kIiwKICAgICI1Lm1kIiwKICAgICI2Lm1kIiwKICAgICI3Lm1kIiwKICAgICI4Lm1kIiwKICAgICI5Lm1kIiwKICAgICIxMC5tZCIsCiAgICAiMTEubWQiLAogICAgIjEyLm1kIiwKICAgICIxMy5tZCIsCiAgICAiMTQubWQiLAogICAgIjE1Lm1kIiwKICAgICIxNi5tZCIsCiAgICAiMTcubWQiLAogICAgIjE4Lm1kIiwKICAgICIxOS5tZCIsCiAgICAiMjAubWQiLAogICAgIjIxLm1kIiwKICAgICIyMi5tZCIsCiAgICAiMjMubWQiLAogICAgIjI0Lm1kIiwKICAgICIyNS5tZCIsCiAgICAiMjYubWQiCiAgXQp9", "encoding": "base64", "_links": { "self": "https://api.github.com/repos/all-contributors/all-contributors-bot/contents/.all-contributorsrc?ref=master", diff --git a/test/integration/__snapshots__/issue_comment.test.js.snap b/test/integration/__snapshots__/issue_comment.test.js.snap index f7d08260..6bee307c 100644 --- a/test/integration/__snapshots__/issue_comment.test.js.snap +++ b/test/integration/__snapshots__/issue_comment.test.js.snap @@ -1,23 +1,23 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`issue_comment event .all-contributorsrc has 16 files: logs 1`] = ` +exports[`issue_comment event .all-contributorsrc has 26 files: logs 1`] = ` Array [ Object { "error": "AllContributorBotError", "id": "1", "isKnownError": true, "level": 30, - "msg": "Your .all-contributorsrc cannot contain more than 15 files.", + "msg": "Your .all-contributorsrc cannot contain more than 25 files.", "name": "event", }, ] `; -exports[`issue_comment event .all-contributorsrc has 16 files: request body 1`] = ` +exports[`issue_comment event .all-contributorsrc has 26 files: request body 1`] = ` Object { "body": "@jakebolam -Your .all-contributorsrc cannot contain more than 15 files.", +Your .all-contributorsrc cannot contain more than 25 files.", } `; diff --git a/test/integration/issue_comment.test.js b/test/integration/issue_comment.test.js index df7b67fb..dc1d6048 100644 --- a/test/integration/issue_comment.test.js +++ b/test/integration/issue_comment.test.js @@ -14,7 +14,7 @@ const issueCommentCreatedNotForAppPayload = require("../fixtures/issue_comment.c const issueCommentCreatedPayloadUnknownIntention = require("../fixtures/issue_commented.created.unknown-intention.json"); const issueCommentCreatedPayloadUnknownContribution = require("../fixtures/issue_comment.created-unknown-contribution.json"); const reposGetContentsAllContributorsRCdata = require("../fixtures/repos.getContents.all-contributorsrc.json"); -const reposGetContentsAllContributorsRCdata16files = require("../fixtures/repos.getContents.all-contributorsrc-16-files.json"); +const reposGetContentsAllContributorsRCdata26files = require("../fixtures/repos.getContents.all-contributorsrc-26-files.json"); const reposGetContentsAllContributorsRCdataSkipCiFalse = require("../fixtures/repos.getContents.all-contributorsrc-skip-ci-false.json"); const reposGetContentsAllContributorsRCdataInvalidSyntax = require("../fixtures/repos.getContents.all-contributorsrc-invalid-syntax.json"); const usersGetByUsernameJakeBolamdata = require("../fixtures/users.getByUsername.jakebolam.json"); @@ -480,27 +480,27 @@ describe("issue_comment event", () => { test("Fail path, add existing contributor with already exist contribution type", async () => { const mock = nock("https://api.github.com") - .get( - `/repos/all-contributors/all-contributors-bot/git/ref/heads%2Fall-contributors%2Fadd-jakebolam` - ) - .reply(404) - - .get( - "/repos/all-contributors/all-contributors-bot/contents/.all-contributorsrc?ref=master" - ) - .reply(200, reposGetContentsAllContributorsRCdata) - - .get("/users/jakebolam") - .reply(200, usersGetByUsernameJakeBolamdata) - - .post( - "/repos/all-contributors/all-contributors-bot/issues/1/comments", - (body) => { - expect(body).toMatchSnapshot("request body"); - return true; - } - ) - .reply(200); + .get( + `/repos/all-contributors/all-contributors-bot/git/ref/heads%2Fall-contributors%2Fadd-jakebolam` + ) + .reply(404) + + .get( + "/repos/all-contributors/all-contributors-bot/contents/.all-contributorsrc?ref=master" + ) + .reply(200, reposGetContentsAllContributorsRCdata) + + .get("/users/jakebolam") + .reply(200, usersGetByUsernameJakeBolamdata) + + .post( + "/repos/all-contributors/all-contributors-bot/issues/1/comments", + (body) => { + expect(body).toMatchSnapshot("request body"); + return true; + } + ) + .reply(200); await probot.receive({ name: "issue_comment", @@ -512,7 +512,7 @@ describe("issue_comment event", () => { expect(output).toMatchSnapshot("logs"); }); - test(".all-contributorsrc has 16 files", async () => { + test(".all-contributorsrc has 26 files", async () => { const mock = nock("https://api.github.com") .get( `/repos/all-contributors/all-contributors-bot/git/ref/heads%2Fall-contributors%2Fadd-jakebolam` @@ -525,7 +525,7 @@ describe("issue_comment event", () => { .get( "/repos/all-contributors/all-contributors-bot/contents/.all-contributorsrc?ref=master" ) - .reply(200, reposGetContentsAllContributorsRCdata16files) + .reply(200, reposGetContentsAllContributorsRCdata26files) .post( "/repos/all-contributors/all-contributors-bot/issues/1/comments",