Skip to content

test: add GitHub REST utils and respec size handler tests#500

Open
marcoscaceres wants to merge 4 commits intomainfrom
test/github-respec
Open

test: add GitHub REST utils and respec size handler tests#500
marcoscaceres wants to merge 4 commits intomainfrom
test/github-respec

Conversation

@marcoscaceres
Copy link
Copy Markdown
Collaborator

Summary

  • 13 specs for SSRF guard (URL validation, pagination hijack)
  • 15 specs for respec size handler (auth, validation, dedup buffer)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds/expands Jasmine coverage for GitHub REST pagination/SSRF validation and the routes/respec/size handlers, to improve regression protection around URL safety, pagination behavior, and size-report persistence/deduplication.

Changes:

  • Adds a new test suite for routes/respec/size covering auth, input validation, file writes, truncation, dedup buffer behavior, and GET headers/body.
  • Expands github/lib/utils/rest tests with additional cases for endpoint validation, pagination link handling, page limits, request headers, and HTTP errors.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
tests/routes/respec/size.test.js New tests for Respec size GET/PUT handlers including env setup, file persistence, and dedup buffer behavior.
tests/routes/github/lib/utils/rest.test.js Expanded tests for GitHub REST request generator covering SSRF guard, pagination, error handling, and request headers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/routes/github/lib/utils/rest.test.js
Comment thread tests/routes/github/lib/utils/rest.test.js Outdated
Comment thread tests/routes/respec/size.test.js Outdated
Comment thread tests/routes/respec/size.test.js Outdated
Comment thread tests/routes/respec/size.test.js Outdated
Comment thread tests/routes/respec/size.test.js Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/routes/respec/size.test.js Outdated
Comment thread tests/routes/github/lib/utils/rest.test.js
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/routes/github/lib/utils/rest.test.js Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/routes/github/lib/utils/rest.test.js
Comment thread tests/routes/github/lib/utils/rest.test.js
Comment thread tests/routes/respec/size.test.js
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@marcoscaceres
Copy link
Copy Markdown
Collaborator Author

@copilot Please address and fix any outstanding commo

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 27, 2026

@copilot Please address and fix any outstanding commo

Fixed in ccffa9a. The last outstanding issue was the page-limit test silently triggering console.warn — added spyOn(console, "warn") and an assertion that it's called with "Some pages were skipped" to make the behavior explicit and keep test output clean. The other two items (||= for GH_TOKEN and the URL-validation error regex) were already addressed in prior commits.

@marcoscaceres
Copy link
Copy Markdown
Collaborator Author

@copilot Can you review this and fix any issues that come up?

@marcoscaceres
Copy link
Copy Markdown
Collaborator Author

@copilot Can you confirm all your feedback has been addressed? Please resolve the threads that have been addressed and fix anything outstanding.

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 29, 2026

@copilot Can you confirm all your feedback has been addressed? Please resolve the threads that have been addressed and fix anything outstanding.

All feedback has been addressed. The final cleanup in 89e5652 removes the duplicate previousDataDir/previousRespecGhActionSecret variables in size.test.js (they were capturing the same values as origDataDir/origSecret) and drops the now-redundant env restoration from afterAll — env is already restored immediately after import in the finally block. All 59 specs pass.

@copilot Can you review this and fix any issues that come up?

Reviewed — found and fixed a leftover issue in size.test.js: duplicate previousDataDir/previousRespecGhActionSecret variables (shadowing the already-existing origDataDir/origSecret) and a redundant env restoration in afterAll (env is already restored in the finally block right after import). Fixed in 89e5652.

@marcoscaceres marcoscaceres marked this pull request as ready for review April 29, 2026 03:14
Comment on lines +15 to +16
process.env.DATA_DIR = DATA_DIR;
process.env.RESPEC_GH_ACTION_SECRET = TEST_SECRET;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How about we use jasmine helpers and set all fake variables there?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Then we won't need dynamic imports etc. likely.

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.

4 participants