vikunja/veans/internal/client
Tink bot 4cda019336 test(veans): cover client error mapping, pagination, and 404→BOT_USERS_UNAVAILABLE
internal/client/ had no coverage for the helpers that turn HTTP
responses into the stable error envelope. e2e exercises happy paths
but never asserts the envelope's Code field for each status, so a
refactor of mapHTTPError could silently drift.

Seven tests in client_test.go:

- TestMapHTTPError_StatusCodeMapping table-drives 401/403/404/409/
  429/400/422/500 → the right output.Code constants.
- TestMapHTTPError_RetryAfterAppendedToMessage asserts the
  (retry-after <dur>) suffix on 429s.
- TestMapHTTPError_BodyTruncation pumps 600 bytes and asserts the
  message ends with …(truncated) and Cause stays nil (per the earlier
  'drop synthetic Cause' change).
- TestMapHTTPError_VikunjaJSONTakesPrecedenceOverRawBody asserts the
  parsed {code,message} payload wins over the raw body for the
  embedded message text.
- TestParseRetryAfter handles delta-seconds, HTTP-date forms (with a
  tolerance window because the parser uses time.Until), and the
  unparseable/empty/negative/past-date cases.
- TestPaginationDone covers the header-authoritative and len-heuristic
  branches across full, short, and empty pages.
- TestCreateBotUser_404TranslatesToBotUsersUnavailable drives a
  fake httptest server returning 404 on PUT /api/v1/user/bots and
  asserts the error code is BOT_USERS_UNAVAILABLE (the translation
  lives in users.go:37-42).
2026-05-27 08:21:57 +00:00
..
assignees.go feat(veans): install agent hooks during init instead of just printing 2026-05-27 08:21:57 +00:00
auth.go chore(veans): apply veans golangci pass across sources 2026-05-27 08:21:57 +00:00
buckets.go chore(veans): apply veans golangci pass across sources 2026-05-27 08:21:57 +00:00
client.go feat(veans): make the HTTP client timeout configurable via .veans.yml 2026-05-27 08:21:57 +00:00
client_test.go test(veans): cover client error mapping, pagination, and 404→BOT_USERS_UNAVAILABLE 2026-05-27 08:21:57 +00:00
comments.go chore(veans): apply veans golangci pass across sources 2026-05-27 08:21:57 +00:00
discover.go feat(veans): URL discovery on init, port of the frontend's heuristic 2026-05-27 08:21:57 +00:00
discover_test.go feat(veans): URL discovery on init, port of the frontend's heuristic 2026-05-27 08:21:57 +00:00
info.go chore(veans): apply veans golangci pass across sources 2026-05-27 08:21:57 +00:00
labels.go feat(veans): offer "create a new project" from init's picker 2026-05-27 08:21:57 +00:00
projects.go feat(veans): offer "create a new project" from init's picker 2026-05-27 08:21:57 +00:00
relations.go chore(veans): apply veans golangci pass across sources 2026-05-27 08:21:57 +00:00
routes.go chore(veans): apply veans golangci pass across sources 2026-05-27 08:21:57 +00:00
routes_test.go chore(veans): apply veans golangci pass across sources 2026-05-27 08:21:57 +00:00
tasks.go feat(veans): offer "create a new project" from init's picker 2026-05-27 08:21:57 +00:00
tokens.go feat(veans): install agent hooks during init instead of just printing 2026-05-27 08:21:57 +00:00
types.go feat(veans): offer "create a new project" from init's picker 2026-05-27 08:21:57 +00:00
users.go feat(veans): install agent hooks during init instead of just printing 2026-05-27 08:21:57 +00:00