fix(products): handle product level attributes when value is undefined#1975
Conversation
🦋 Changeset detectedLatest commit: 9a4c036 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1975 +/- ##
=======================================
Coverage 98.48% 98.48%
=======================================
Files 117 117
Lines 3027 3027
Branches 854 854
=======================================
Hits 2981 2981
Misses 42 42
Partials 4 4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…en type is not passed
markus-azer
left a comment
There was a problem hiding this comment.
@nicolasnieto92 i have concern that this field type: 'text' shouldnt be passed to sync actions
markus-azer
left a comment
There was a problem hiding this comment.
Such great and blazing fast fix 💪 💪 💯
just nitpick, maybe the release note need to be updated.
| test('should not fail when type is not passed', () => { | ||
| const before = { | ||
| attributes: [ | ||
| { | ||
| type: 'text', | ||
| name: 'batteryIncluded', | ||
| value: 'No', | ||
| }, | ||
| ], | ||
| } | ||
|
|
||
| const now = { | ||
| attributes: [ | ||
| { | ||
| name: 'batteryIncluded', | ||
| value: 'No', | ||
| }, | ||
| ], | ||
| } | ||
| const actions = productsSync.buildActions(now, before) | ||
|
|
||
| expect(actions).toEqual([]) | ||
| }) |
There was a problem hiding this comment.
that test seems to be invalid since product attributes doesnt contain type.
could we replace that with the failed case regarding money attribute.
There was a problem hiding this comment.
| sameForAllAttributeNames | ||
| ) { | ||
| if (!attribute) return undefined | ||
| if (!attribute || !diffedValue) return undefined |
There was a problem hiding this comment.
since this package already super confusing, please feel free to add some comment or ask AI to add it :)
Summary
Addresses support ticket -> https://commercetools.atlassian.net/browse/SUPPORT-35323
It will otherwise fail here -> https://github.com/commercetools/nodejs/pull/1975/files#diff-63a751d2be0c519a17853d0536c478de2af9a92630fa9a2e99af98837e39a6b4R111