Docs: Update AGENTS.md

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer
2025-09-21 14:17:54 +02:00
parent 6901225a2b
commit 93493aba28

View File

@@ -162,7 +162,7 @@ If anything in this file conflicts with the `Makefile` or the Developer Guide, t
- Unit/subpackage: `go test ./internal/<pkg> -run <Name> -count=1` - Unit/subpackage: `go test ./internal/<pkg> -run <Name> -count=1`
- Commands: `go test ./internal/commands -run <Name> -count=1` - Commands: `go test ./internal/commands -run <Name> -count=1`
- Avoid `./...` unless you intend to run the whole suite. - Avoid `./...` unless you intend to run the whole suite.
- Heavy tests (migrations/fixtures): internal/entity and internal/photoprism run DB migrations and load fixtures; expect 30120s on first run. Narrow with `-run` and keep iterations low. - Heavy tests (migrations/fixtures): `internal/entity` and `internal/photoprism` run DB migrations and load fixtures; expect 30120s on first run. Narrow with `-run` and keep iterations low.
- PhotoPrism config in tests: inside `internal/photoprism`, use the package global `photoprism.Config()` for runtimeaccurate behavior. Only construct a new config if you replace it via `photoprism.SetConfig`. - PhotoPrism config in tests: inside `internal/photoprism`, use the package global `photoprism.Config()` for runtimeaccurate behavior. Only construct a new config if you replace it via `photoprism.SetConfig`.
- CLI command tests: use `RunWithTestContext(cmd, args)` to capture output and avoid `os.Exit`; assert `cli.ExitCoder` codes when you need them. - CLI command tests: use `RunWithTestContext(cmd, args)` to capture output and avoid `os.Exit`; assert `cli.ExitCoder` codes when you need them.
- Reports are quoted: strings in CLI "show" output are rendered with quotes by the report helpers. Prefer `assert.Contains`/regex over strict, fully formatted equality when validating content. - Reports are quoted: strings in CLI "show" output are rendered with quotes by the report helpers. Prefer `assert.Contains`/regex over strict, fully formatted equality when validating content.