-
Notifications
You must be signed in to change notification settings - Fork 0
Better testing environment changes #24
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
Conversation
…or variant retrieval
…repository to handle shipping details
…in payment handlers
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 refactors several components in the testing environment and repository layers to improve clarity and maintainability. Key changes include switching product variant attributes from maps to slices of maps in the seeding logic, updating repository interfaces and method signatures (including switching from CreateWithID to Create in cart tests), and enhancing mock behaviors in discount use case tests.
Reviewed Changes
Copilot reviewed 43 out of 43 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/infrastructure/repository/postgres/product_variant_repository.go | Refactored attribute marshalling/unmarshalling and added duplicate SKU error handling. |
| internal/infrastructure/repository/postgres/product_repository.go | Updated GetByIDWithVariants to use consistent naming and integrated new counting methods. |
| internal/infrastructure/repository/postgres/order_repository.go | Extended order methods with additional fields and improved error handling. |
| internal/infrastructure/payment/* | Added ForceApprovePayment methods across payment services. |
| internal/application/usecase/* | Updated use case signatures and validation logic, including shipping method validations and payment capture enhancements. |
| internal/application/usecase/*_test.go | Updated test mocks and repository method calls (replacing CreateWithID with Create). |
| cmd/seed/main.go | Commented out order and payment transaction seeding and updated product variant seeding to support structured attributes. |
Comments suppressed due to low confidence (1)
internal/infrastructure/repository/postgres/product_repository.go:215
- [nitpick] Ensure that the naming conventions for product identifiers are consistent across repository methods; using 'productId' here improves clarity compared to a generic 'id'.
func (r *ProductRepository) GetByIDWithVariants(productId uint) (*entity.Product, error) {
…failures without interrupting the flow
…ping methods to enhance clarity
This pull request introduces several changes across different areas of the codebase, including modifications to the seeding logic, adjustments to the
Cartrepository methods in tests, and updates to theDiscountuse case tests. The most significant updates involve refactoring the structure of product variant attributes, replacing a repository method in test cases, and enhancing the mock order repository initialization.Changes to seeding logic:
cmd/seed/main.go, likely as part of a temporary or debugging measure.attributesfield inseedProductVariantsfrom amap[string]stringto a[]map[string]stringto better support structured attribute data. This change affects multiple locations in thecmd/seed/main.gofile. [1] [2] [3] [4] [5] [6] [7]Changes to
Cartrepository methods in tests:cartRepo.CreateWithIDwithcartRepo.Createin various test cases ininternal/application/usecase/cart_usecase_test.go, simplifying the repository interface and aligning it with the standardCreatemethod. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18]Updates to
Discountuse case tests:mock.NewMockOrderRepositoryininternal/application/usecase/discount_usecase_test.goto include afalseparameter, likely to control specific behavior in the mock implementation. [1] [2] [3] [4] [5] [6] [7] [8]