Add unit tests for src/backend/server/server.go
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 432
- Forks
- 51
- PR merge metrics
- No merged PRs in 30d
Description
src/backend/server/server.go (~28KB) handles HTTP request orchestration but has no server_test.go next to it. The rest of the backend (pii/, proxy/, providers/, config/) has companion test files, so the server is an outlier.
What to add
Create src/backend/server/server_test.go covering at least:
- Happy-path request handling for one provider (OpenAI is fine)
- Malformed JSON body — should return 400
- Empty body — should return 400
- Missing/invalid
Authorizationheader pass-through - Concurrent request handling (table-driven with
t.Parallel())
Hints
- Use
httptest.NewRecorder()/httptest.NewServer()— seesrc/backend/proxy/handler_test.gofor the pattern already in use here. - Stub or fake the PII detector + provider — you don't need a real ONNX model.
- Run with
make test-allorgo test ./src/backend/server/....
Difficulty: good first issue, ~1–2 hours.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/backend/server/server.go and compare the test setup in src/backend/proxy/handler_test.go. Create src/backend/server/server_test.go using fake PII and provider components, then run go test ./src/backend/server/... or make test-all; done means coverage for the listed success, error, authorization, and concurrent-request cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend, testing
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 84/100