api-smoke-test
GitHub用于在开发环境中对后端API接口进行冒烟测试,通过curl验证路由、中间件及数据序列化等功能,旨在捕获单元测试遗漏的集成错误。
触发场景
安装
npx skills add HiEventsDev/Hi.Events --skill api-smoke-test -g -y
SKILL.md
Frontmatter
{
"name": "api-smoke-test",
"description": "Exercise changed backend endpoints against the running dev stack with curl. Use after backend changes to catch wiring bugs unit tests miss (routes, middleware, validation, serialization)."
}
API smoke test
Base URL https://localhost:8443/api (self-signed certificate, so curl -sk). Routes are in backend/routes/api.php. Send Accept: application/json, or validation errors come back as a 302 instead of a 422.
Get data and a token
From docker/development:
docker compose -f docker-compose.dev.yml exec backend php artisan dev:bootstrap
This creates a verified SUPERADMIN account, an organizer, LIVE single and recurring events, products (the paid one has a waitlist), a promo code and an affiliate, and prints their ids and a Bearer token.
Manual login (token field → Authorization: Bearer <token>):
curl -sk -X POST https://localhost:8443/api/auth/login -H "Content-Type: application/json" -H "Accept: application/json" -d '{"email":"<email>","password":"<password>"}'
Request gotchas
- Product upsert requires
product_type(TICKET/GENERAL),type(FREE/PAID/DONATION/TIERED) andproduct_category_id. - Promo create requires
applicable_product_ids: [](empty = all products). - Public order complete requires
email_confirmationon the order and on each product entry. - Publishing needs
accounts.account_verified_at;/admin/*needs roleSUPERADMIN.dev:bootstraphandles both. - Box office door API (
/api/public/box-offices/{short_id}):POST …/sessionswithoperator_nameand apin(fromPOST /api/events/{id}/box-offices/{box_office_id}/reset-pin) returns a token to send asX-Box-Office-Session.
Side effects
- Emails land in Mailpit at
http://localhost:8025(/api/v1/search?query=to:<addr>). - Queued work (emails, webhooks) needs a queue worker:
docker compose -f docker-compose.dev.yml exec -d backend php artisan queue:work.
版本历史
- 439a48b 当前 2026-10-19 04:33


