Refactor testing framework to utilize Ginkgo for unit tests and introduce a new test-all target for running both unit and integration tests. Update README and Taskfile to reflect changes in test execution commands and clarify dependencies. Migrate domain models to a new model package for better separation of concerns.

This commit is contained in:
windyboy
2025-11-16 09:58:49 +08:00
parent a96cb8a40b
commit 487a0acb48
18 changed files with 244 additions and 164 deletions
+16 -6
View File
@@ -55,10 +55,15 @@ tasks:
GO_ENV=${GO_ENV:-dev} go run {{.cmd}} listen
test:
desc: Run go test ./...
desc: Run Ginkgo unit test suites
cmds:
- echo "Running go test..."
- go test ./...
- |
if ! command -v ginkgo >/dev/null; then
echo "Install ginkgo (go install github.com/onsi/ginkgo/v2/ginkgo@latest)"
exit 1
fi
- echo "Running Ginkgo unit test suites..."
- ginkgo -r ./cmd ./internal
test-int:
desc: Run integration tests (requires Docker)
@@ -68,10 +73,15 @@ tasks:
GO_ENV=${GO_ENV:-test} go test -tags=integration ./test/integration/...
test-ginkgo:
desc: Run ginkgo suites
desc: Alias for Ginkgo unit test suites
cmds:
- command -v ginkgo >/dev/null || { echo "Install ginkgo (go install github.com/onsi/ginkgo/v2/ginkgo@latest)"; exit 1; }
- ginkgo -r -v
- task: test
test-all:
desc: Run unit tests (Ginkgo) and integration tests
cmds:
- task: test
- task: test-int
coverage:
desc: Generate coverage report (profile + HTML)