-
Notifications
You must be signed in to change notification settings - Fork 0
Fix/medusa service update always returns array #3
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
base: develop
Are you sure you want to change the base?
Conversation
Important Review skippedMore than 25% of the files skipped due to max files limit. The review is being skipped to prevent a low-quality review. 91 files out of 298 files are above the max files limit of 200. You can disable this status message by setting the WalkthroughThe update modifies the internal implementation of the "update" method in the MedusaService factory within the @medusajs/utils package. The method now passes the input data directly to the service's update method, removing previous normalization that wrapped non-array inputs in an array. Test mocks and test cases were added to verify consistent handling of single objects and arrays in Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant MedusaService
participant UnderlyingService
Caller->>MedusaService: update(data)
MedusaService->>UnderlyingService: update(data)
UnderlyingService-->>MedusaService: result
MedusaService-->>Caller: serialized result
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
@codegen-sh ![]() I received this feedback: ![]() Can you go do some research to see where we could add a test for this? If you have a high confidence you can do it, go add the test. If you are unsure just come back and tell me what you found.
|
🧪 View PR #4 I've successfully added comprehensive tests for the medusa-service create/update methods and implemented your bug fix! The tests validate that both medusa-service.ts and medusa-service.spec.ts properly handle single object vs array input/output consistency. What I Found & Fixed✅ Confirmed the Bug: The Test Coverage Added
The tests would fail with the old buggy code and pass with your fix, providing robust validation that the issue is resolved. This should give the Medusa team confidence to merge your original PR! 🎉 💻 View my work • React 👍 or 👎 |
- Add tests for single object input/output consistency - Add tests for array input/output consistency - Add proper mocks for create/update service methods - Fix update method to preserve input type (single object vs array) - Tests validate the bug fix where update method was always returning arrays
…ub.com:lambda-curry/medusa into fix/medusa-service-update-always-returns-array
* docs: add missing prop to kapa * change to cookie
) Co-authored-by: olivermrbl <[email protected]>
Co-authored-by: shahednasser <[email protected]>
…2941) Co-authored-by: shahednasser <[email protected]> Co-authored-by: Shahed Nasser <[email protected]>
Co-authored-by: shahednasser <[email protected]>
* docs: changes for new releases + fixes * remove container option
Co-authored-by: shahednasser <[email protected]> Co-authored-by: Shahed Nasser <[email protected]>
* chore: upgrade to latest zod v3 * chore: set explicit versions * chore: remove v3 scope --------- Co-authored-by: Oli Juhl <[email protected]>
…2950) * docs: added a note linking to create-medusa-app reference * Update page.mdx
…ved (medusajs#12919) **What** - don't call `updateOrderTaxLinesWorkflow` when a shipping method is removed from a draft order (tax lines will be cascade deleted with the method)
Co-authored-by: Stevche Radevski <[email protected]>
**What** - sync latest Figma icons and ui presets
…lve edge case for adjustments calculation (medusajs#13106) * Move from total to original_total to resolve edge case in adjustment calculation * Added changeset * Added test case for correction --------- Co-authored-by: Oli Juhl <[email protected]>
…ssword guide (medusajs#13122) * docs: added guide on sending invite user emails + updates to reset password guide * fix vale error
* update everything from version to since * update events * regenerate oas
…tion is applied (medusajs#13131) * Fix on precision for high quantities for items when promotion is applied * Fix on precision for high quantities for items when promotion is applied
* chore(dashboard): add missing US states * fix: add missing territiories
Fixes medusajs#13135 Co-authored-by: Shahed Nasser <[email protected]>
* docs: generate invoice tutorial * fix vale error * add missing icon * fix sidebar * update date
New link to www
Co-authored-by: william bouchard <[email protected]>
Changed the In operator to actually work like an In instead of being same logic as Equals. This means that in promotions you can add a rule to apply when a product is in a category or multiple different. Before the logic had to match all the products categories to apply, which doesnt really make sense when you have nested category structure on products. The logic also applies to tags where you can make a rule apply based on a tag before it also had to match all tags on a product to apply. Issue: medusajs#12669 Co-authored-by: Carlos R. L. Rodrigues <[email protected]>
* chore(core-flows): throw error on invalid promo code * add changelog * better error handling in test --------- Co-authored-by: william bouchard <[email protected]> Co-authored-by: Carlos R. L. Rodrigues <[email protected]>
Summary by CodeRabbit