vikunja/veans/internal/bootstrap
Tink bot 98affb265a test(veans): cover bootstrap validators and prompt UX
Three helpers I added recently have no e2e coverage because the
suite always passes --bot-username with a valid name and
--yes-buckets to skip prompts.

Nine tests in a new bootstrap_test.go:

- TestValidateBotUsername — table-driven, 18 rows: valid shapes
  (bot-foo, bot-foo-bar, bot-foo123, bot-foo_bar, bot-foo.bar,
  bot-a), invalid prefix (foo, Bot-foo, ""), invalid chars
  (spaces, commas, uppercase, !, embedded space), the reserved
  link-share-N pattern, and the bare "bot-" edge.

- TestConfirmOverwriteExistingConfig — file-missing path, the
  OverwriteExistingConfig=true short-circuit, every interesting
  prompt answer (y, yes, Y, Yes, "  yes  " → proceed; n, "",
  garbage → CodeConflict with path in message; prompter error
  → CodeUnknown wrapping the original via errors.Is).

- TestBootstrapBuckets_{AllPresent,AutoApprove,PromptDeclined,
  PromptAborted,PromptUnknownCap,PromptAccepted} — drive the
  function against a stub httptest server (bucketServer helper)
  that records ListBuckets responses and CreateBucket payloads,
  with a scripted queuePrompter for the prompt-driven cases.
  Covers the alias-match short circuit, the auto-approve path,
  the new declined/aborted/retry-cap paths, and the y-accepted
  path.

Local helpers (queuePrompter for scripted answers with injectable
error; bucketServer for the stubbed bucket endpoints) stay in the
test file — no production code changes.
2026-05-27 08:21:57 +00:00
..
bootstrap.go feat(veans): warn when Chain.Set falls back past a failed backend 2026-05-27 08:21:57 +00:00
bootstrap_test.go test(veans): cover bootstrap validators and prompt UX 2026-05-27 08:21:57 +00:00
botuser.go feat(veans): reuse owned bot or prompt for fresh name on collision 2026-05-27 08:21:57 +00:00
botuser_test.go feat(veans): reuse owned bot or prompt for fresh name on collision 2026-05-27 08:21:57 +00:00
hooks.go feat(veans): offer "create a new project" from init's picker 2026-05-27 08:21:57 +00:00
hooks_test.go feat(veans): install agent hooks during init instead of just printing 2026-05-27 08:21:57 +00:00