Skip to content

fix(products): handle product level attributes when value is undefined#1975

Merged
nicolasnieto92 merged 5 commits into
masterfrom
fix/product-level-attributes
Sep 19, 2025
Merged

fix(products): handle product level attributes when value is undefined#1975
nicolasnieto92 merged 5 commits into
masterfrom
fix/product-level-attributes

Conversation

@nicolasnieto92
Copy link
Copy Markdown
Contributor

@nicolasnieto92 nicolasnieto92 commented Sep 19, 2025

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Sep 19, 2025

🦋 Changeset detected

Latest commit: 9a4c036

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@commercetools/sync-actions Minor

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
Copy link
Copy Markdown

codecov Bot commented Sep 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.48%. Comparing base (ddbbfb9) to head (0b8ac89).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@markus-azer markus-azer left a comment

Choose a reason for hiding this comment

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

@nicolasnieto92 i have concern that this field type: 'text' shouldnt be passed to sync actions

Copy link
Copy Markdown
Member

@markus-azer markus-azer left a comment

Choose a reason for hiding this comment

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

Such great and blazing fast fix 💪 💪 💯

just nitpick, maybe the release note need to be updated.

Comment on lines +841 to +863
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([])
})
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

that test seems to be invalid since product attributes doesnt contain type.
could we replace that with the failed case regarding money attribute.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

release notes updated 0b8ac89

sameForAllAttributeNames
) {
if (!attribute) return undefined
if (!attribute || !diffedValue) return undefined
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

since this package already super confusing, please feel free to add some comment or ask AI to add it :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

here 😄 -> 9a4c036

@nicolasnieto92 nicolasnieto92 changed the title fix(products): handle product level attributes when type is not passed fix(products): handle product level attributes when value is undefined Sep 19, 2025
@nicolasnieto92 nicolasnieto92 merged commit a550762 into master Sep 19, 2025
14 of 15 checks passed
@nicolasnieto92 nicolasnieto92 deleted the fix/product-level-attributes branch September 19, 2025 16:55
@ct-changesets ct-changesets Bot mentioned this pull request Sep 19, 2025
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.

3 participants