昨天我們還在把 API 升級成「能篩選、能 patch、能對齊文件」的版本。今天,正式進入下一個里程碑:
👉 不再只看單表單元測試,而是跑一個完整的整合測試流程。
同時,也開始準備產品線「必備三寶」:
internal/integration/integration_test.go,模擬 公司 → 使用者 → 專案 → Bot → 目的地 → 通知 全流程。go test ./...,確認全綠 ✅。company_service_test.go
user_service_test.go
project_service_test.go
destination_service_test.go
notification_service_test.go
go test ./...,依舊全綠,心裡終於沒那麼慌。http://localhost:8081/ 啥都沒有。-p 8081:8080 改成 -p 8081:7070,重新啟動容器,總算能看到文件頁面。docker run --name openapi-ui -d -p 8081:7070 ...
doc/CI_PLAN.md,規劃未來要把 go test ./...、swagger validate、lint 全部串到 CI。doc/INTEGRATION_TEST_PLAN.md
doc/API_PLANS.md
doc/CI_PLAN.md
internal/integration/integration_test.go
internal/api/services/*_test.go
go test ./... 全綠curl http://localhost:7070/health 回傳 ok今天像是第一次辦「系統健康檢查」:
不足之處:
go test 或 Makefile,避免人為失誤。✍️ Day13 收工感言:
今天是「API 工地驗收日」,整合測試跑過、Swagger UI 上線、CI 藍圖出爐。
雖然還只是 prototype,但至少不再是裸奔的 CRUD,而是一個有 測試、有文件、有驗收 的工程專案了。 🚀