Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GitHubAPI.getPullRequestComments #1468

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

kfbustam
Copy link

@kfbustam kfbustam commented Dec 9, 2024

  • Memoize getPullRequestComment
    (Context: the runner process remains active during the job execution. Memoizing the data will improve performance by avoiding redundant API calls and can help you stay within GitHub's rate limits.)
  • Fix test it("getDangerCommentIDs ignores comments not marked as generated")
  • Write test it("getPullRequestComment gets only comments for given Pull Request")

Test Plan

https://github.com/danger/danger-js/actions/runs/12228145418/job/34105926888?pr=1468

@kfbustam kfbustam changed the title update GitHubAPI.getPullRequestComments Update GitHubAPI.getPullRequestComments and fix getDangerCommentIDs test Dec 9, 2024
@@ -113,13 +113,24 @@ new file mode 0

it("getDangerCommentIDs ignores comments not marked as generated", async () => {
api.getAllOfResource = await requestWithFixturedJSON("github_inline_comments_with_danger.json")
api.getUserID = () => new Promise<number>((r) => r(20229914))
api.fetch = jest.fn().mockReturnValue({ ok: true })
Copy link
Author

@kfbustam kfbustam Dec 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was failing because it was making an API call (i.e., not mocked) which isn't allowed so I just included the fix in this PR 😅

@kfbustam kfbustam marked this pull request as ready for review December 9, 2024 03:11
@kfbustam kfbustam changed the title Update GitHubAPI.getPullRequestComments and fix getDangerCommentIDs test Update GitHubAPI.getPullRequestComments Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant