-
Notifications
You must be signed in to change notification settings - Fork 0
handlerのseatのテスト #1255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
handlerのseatのテスト #1255
Conversation
|
Migrate lint Lint output |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request adds and refines tests for seat-related handler functions (GetSeats, PostSeat, and PatchSeatStatus) while introducing a go:generate directive for creating Seat mocks.
- Added a go:generate comment in the service package to automatically generate Seat mocks.
- Introduced comprehensive tests covering normal and error scenarios for GetSeats, PostSeat, and PatchSeatStatus.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/service/seat.go | Added a go:generate directive to facilitate mock generation for the Seat interface. |
| src/handler/v2/seat_test.go | Added detailed tests for seat handlers covering various success and error cases. |
Comments suppressed due to low confidence (1)
src/service/seat.go:3
- Consider adding a brief note near the go:generate directive to remind developers to update the mock generation command if the Seat interface changes, ensuring the mocks stay in sync with interface updates.
//go:generate go tool mockgen -typed -source=seat.go -destination=mock/seat.go -package=mock Seat
| case openapi.InUse: | ||
| status = values.SeatStatusInUse | ||
| default: | ||
| t.Fatalf("invalid seat status: %v", testCase.req.Status) |
Copilot
AI
Jun 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider replacing t.Fatalf with an assertion method like assert.Fail to maintain consistency with other test failure reporting patterns in the code.
| t.Fatalf("invalid seat status: %v", testCase.req.Status) | |
| assert.Fail(t, fmt.Sprintf("invalid seat status: %v", testCase.req.Status)) |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨No code suggestions found for the PR. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1255 +/- ##
==========================================
+ Coverage 49.12% 49.83% +0.70%
==========================================
Files 127 127
Lines 11301 11301
==========================================
+ Hits 5552 5632 +80
+ Misses 5450 5368 -82
- Partials 299 301 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
User description
fix #1089
PR Type
Tests
Description
GetSeatsハンドラのユニットテスト追加
PostSeatハンドラのユニットテスト追加
PatchSeatStatusハンドラのユニットテスト追加
seatサービスmock生成設定追加
Changes walkthrough 📝
seat_test.go
seatハンドラ用テストを網羅的に追加src/handler/v2/seat_test.go
seat.go
mockgen用ディレクティブを追加src/service/seat.go