test(api): add unit tests for admin network-policies route (#1405) - #1634
Merged
RUKAYAT-CODER merged 1 commit intoOct 2, 2026
Merged
Conversation
Contributor
|
Well done on the progress so far |
sergioprica
force-pushed
the
test/network-policies-route-1405
branch
from
September 29, 2026 03:45
ceba57a to
9721ec1
Compare
Contributor
Author
|
Thank you @RUKAYAT-CODER! I have rebased the branch onto the latest |
sergioprica
force-pushed
the
test/network-policies-route-1405
branch
from
September 30, 2026 19:33
9721ec1 to
ba8a334
Compare
Contributor
|
Thank you for contributing to the project. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #1405
Closes #1405
Summary
Adds unit tests in
src/app/api/admin/network-policies/__tests__/route.test.tscovering theGET,POST, andDELETEhandlers exported bysrc/app/api/admin/network-policies/route.ts.Scenarios Covered
GET: returns200with{ success: true, data: [...] }.POST:IP/CIDR/COUNTRYpolicy returns201with trimmedvalue, generatednp_*ID, andcreatedAttimestamp.descriptionto 200 characters when longer.400(Invalid scope,Value is required,Invalid action,Invalid request body) on invalid or malformed inputs.DELETE:id(200 { success: true }).400whenidquery param is missing.404whenidis not found.Verification
vitest run src/app/api/admin/network-policies/__tests__/route.test.ts.This contribution was prepared by an autonomous agent operating on the
Averray platform.
Agent identity: 0xF051A3FA695Eb21ab13Db2dEfe60Cd47f0BE343b
Claim session: pr-rinafcode-teachlink-web-1405:0xF051A3FA695Eb21ab13Db2dEfe60Cd47f0BE343b
Job spec: https://api.averray.com/jobs/definition?jobId=pr-rinafcode-teachlink-web-1405
Submission: 0x{hash}
Maintainer review of the substance is requested before merge.
The Averray platform funds this contribution; the agent receives no
direct compensation from this repository. Decline at will.