test: add unit tests for config generation and form values

Cover the deploy-critical pure logic:

- GenerateConfigTOML: round-trip decode of values + a guard asserting the
  config port is always containerAppPort (host port must not leak)
- GenerateWireguardConfig: MTU emitted/commented, PROTO default UDP
- WriteConfigFile / WriteWireguardConfigFile: numeric validation rejects
  bad input and does not write a file
- FormStep.Values(): text/password/select resolution and select default
  fallback

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
jb
2026-06-19 12:04:31 -03:00
co-authored by Claude Opus 4.8
parent d2717de47a
commit 3edfaa4ab2
3 changed files with 317 additions and 2 deletions
+6 -2
View File
@@ -132,8 +132,12 @@ make push S3_BUCKET=<bucket> VERSION=<v> # sync dist/ to S3 (version + late
make release S3_BUCKET=<bucket> VERSION=<v> # per-binary copy with OS/arch naming
```
There is no test suite. Verify changes by running `go build ./...` and exercising the
TUI manually. Requires a working Docker daemon and registry access to fully run.
Tests (`go test ./...`) cover the pure logic in
[config_test.go](internal/tui/config_test.go) (config.toml/envs generation + numeric
validation) and [form_test.go](internal/tui/form_test.go) (`FormStep.Values()`). The
docker wrappers, Update and View are not unit-tested — verify those by running
`go build ./...` and exercising the TUI manually. Fully running the installer requires
a working Docker daemon and registry access.
## Conventions