Skip to content

Add unit tests for src/backend/server/server.go #428

@hanneshapke

Description

@hanneshapke

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 Authorization header pass-through
  • Concurrent request handling (table-driven with t.Parallel())

Hints

  • Use httptest.NewRecorder() / httptest.NewServer() — see src/backend/proxy/handler_test.go for 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-all or go test ./src/backend/server/....

Difficulty: good first issue, ~1–2 hours.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions