mirror of
https://github.com/vxcontrol/pentagi.git
synced 2026-07-20 23:57:11 -04:00
[PR #214] [MERGED] test: add unit tests for pkg/server/context helpers #241
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/vxcontrol/pentagi/pull/214
Author: @mason5052
Created: 3/17/2026
Status: ✅ Merged
Merged: 3/20/2026
Merged by: @asdek
Base:
feature/next_release← Head:test/server-context-coverage📝 Commits (1)
3e68cb2test: add server context helper coverage📊 Changes
1 file changed (+218 additions, -0 deletions)
View changed files
➕
backend/pkg/server/context/context_test.go(+218 -0)📄 Description
Description of the Change
Problem
backend/pkg/server/context/context.goprovides typed getter functions used across the server layer but had no unit test coverage.Solution
Add
context_test.gowith 15 table-driven unit tests covering all 5 exported functions:GetInt64,GetUint64,GetString,GetStringArray, andGetStringFromSession. Each function has three subtests: found, missing, and wrong-type cases.Session tests use
gin-contrib/sessions/cookiewithhttptestfor a realistic but minimal setup.Closes N/A
Type of Change
Areas Affected
Testing and Verification
Test Configuration
Test Steps
gofmt -w pkg/server/context/context_test.gogo test ./pkg/server/context/... -count=1 -vgo test ./pkg/server/context/... -count=1 -shuffle=ongo vet ./pkg/server/context/...Test Results
Security Considerations
No security implications. Test-only change.
Performance Impact
None. Test-only change.
Documentation Updates
None required.
Deployment Notes
None. Test-only change.
Checklist
Code Quality
go fmtandgo vet(for Go code)Security
Compatibility
Documentation
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.