Skip to content

test(server): expand app.ts coverage and restructure for readability#967

Merged
qoomon merged 5 commits intomainfrom
copilot/add-more-tests-for-app-ts
Mar 20, 2026
Merged

test(server): expand app.ts coverage and restructure for readability#967
qoomon merged 5 commits intomainfrom
copilot/add-more-tests-for-app-ts

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 19, 2026

  • Analyze existing test coverage and identify uncovered cases
  • Add GET / root path test
  • Add BAD_REQUEST: owner with empty repositories
  • Add BAD_REQUEST: repositories count exceeds max (32)
  • Add BAD_REQUEST: body exceeds size limit (413)
  • Add BAD_REQUEST: unknown top-level field in request body
  • Add OK: with explicit owner field matching repositories
  • Add OK: multiple repositories from same owner
  • Add OK: response includes token_hash field (tightened to exact SHA-256 base64 shape)
  • Add OK: legacy scope=owner with empty repos → ALL
  • Add OK: legacy scope=owner with non-empty repos
  • Restructure tests with feature-oriented describe blocks (authentication, request body validation, access control, successful token creation)
  • Run tests - all 48 tests pass (49 total in full suite)

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

- Add GET / root path test (GitHub project URL)
- Add body size limit exceeded test (413 REQUEST_TOO_LONG)
- Add owner with empty repositories test (BAD_REQUEST)
- Add repositories count exceeds max test (BAD_REQUEST)
- Add unknown top-level field test (BAD_REQUEST)
- Add explicit owner field test (OK)
- Add multiple repositories test (OK)
- Add token_hash response field test (OK)
- Add legacy scope=owner with empty repos test (OK)
- Add legacy scope=owner with non-empty repos test (OK)
- Rename describes: UNAUTHORIZED->authentication, BAD REQUEST->request body validation, FORBIDDEN->access control, OK->successful token creation
- Add sub-describes for body format, permissions, repositories, owner
- Add legacy request body support sub-describe

Co-authored-by: qoomon <3963394+qoomon@users.noreply.github.com>
Copilot AI changed the title [WIP] Add more tests for app.ts with improved structure feat(tests): expand app.ts coverage and restructure for readability Mar 19, 2026
Copilot AI requested a review from qoomon March 19, 2026 17:57
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

Expands and reorganizes app.test.ts to improve coverage and readability of the server’s Hono app routes, especially around /access_tokens validation and success/legacy request flows.

Changes:

  • Adds a new test for GET / returning the project URL.
  • Restructures /access_tokens tests into intent-based describe blocks (authentication, request body validation, access control, successful token creation).
  • Adds new coverage for body-size limiting, stricter request validation scenarios, token hashing in responses, and legacy request-body support.

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

You can also share your feedback on Copilot code review. Take the survey.

Comment thread server/test/app.test.ts Outdated
qoomon and others added 2 commits March 19, 2026 19:28
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@qoomon qoomon marked this pull request as ready for review March 19, 2026 18:32
@qoomon
Copy link
Copy Markdown
Owner

qoomon commented Mar 19, 2026

@copilot apply changes based on the comments in this thread

…chars, ==)

Co-authored-by: qoomon <3963394+qoomon@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 19, 2026

@copilot apply changes based on the comments in this thread

Done in 2c06dc3. Hono's sha256 returns a 64-char hex string, which toBase64 encodes as text — producing exactly 88 base64 characters always ending with ==. Updated the regex to /^[A-Za-z0-9+/]{86}==$/.

Copilot AI requested a review from qoomon March 19, 2026 18:36
@qoomon qoomon changed the title feat(tests): expand app.ts coverage and restructure for readability test(server): expand app.ts coverage and restructure for readability Mar 20, 2026
@qoomon qoomon merged commit 3539f15 into main Mar 20, 2026
6 checks passed
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.

3 participants