Skip to content
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

feat: fill shippingInfo on setShippingMethod #223

Conversation

mickdekkers
Copy link
Member

@mickdekkers mickdekkers commented Oct 3, 2024

We were having some trouble writing tests around a shipping method because cart.shippingInfo.taxedPrice wasn't populated by the mocking library. This PR aims to fix that.

Status

Currently looking for feedback, particularly on the unresolved questions below. A couple t's left to cross and i's left to dot, but so far the newly written tests pass and it works as expected when testing locally (symlinked) in our project.

Will also add a changeset.

Questions

There's a couple remaining questions around edge cases:

Copy link

changeset-bot bot commented Oct 3, 2024

⚠️ No Changeset found

Latest commit: 125fa04

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

The `?? false` part of the expression was never evaluated, but the result was still correct because
`!undefined === true`. This commit mainly fixes the TS2869 typescript errors.
We need it in the cart setShippingMethod action
- Ensure shipping method matches cart
- Ensure shipping rate matches cart
- Use correct shipping rate tier for determining price when applicable
- Improve error handling & reporting
This got accidentally overwritten during a git merge conflict.
Restoring them to reduce noise in the diff
@mickdekkers mickdekkers marked this pull request as ready for review October 15, 2024 11:34
@mickdekkers mickdekkers changed the title feat: WIP fill shippingInfo on setShippingMethod feat: fill shippingInfo on setShippingMethod Oct 15, 2024
Copy link
Member Author

@mickdekkers mickdekkers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, I still had the comment on line 12 of src/shipping.ts in draft. Thought I'd submitted it already

src/shipping.ts Show resolved Hide resolved
src/shipping.ts Show resolved Hide resolved
@okkevandereijk okkevandereijk merged commit 2eaec65 into labd:main Oct 16, 2024
11 checks passed
mickdekkers added a commit to mickdekkers/commercetools-node-mock that referenced this pull request Oct 16, 2024
okkevandereijk pushed a commit that referenced this pull request Oct 16, 2024
Also remove todo comments that were already resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants