Skip to content

Commit

Permalink
feat: add changeactive action and test (#1897)
Browse files Browse the repository at this point in the history
* feat: add changeactive action and test

* chore: changeset
  • Loading branch information
antoniolodias authored Jun 12, 2024
1 parent 1da0f3a commit 940dd70
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/shy-onions-explode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@commercetools/sync-actions': minor
---

add changeActive to shipping methods base actions
1 change: 1 addition & 0 deletions packages/sync-actions/src/shipping-methods-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const baseActionsList = [
{ action: 'changeIsDefault', key: 'isDefault' },
{ action: 'setPredicate', key: 'predicate' },
{ action: 'changeTaxCategory', key: 'taxCategory' },
{ action: 'changeActive', key: 'active' },
]

export function actionsMapBase(diff, oldObj, newObj, config = {}) {
Expand Down
19 changes: 19 additions & 0 deletions packages/sync-actions/test/shipping-methods.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe('Exports', () => {
{ action: 'changeIsDefault', key: 'isDefault' },
{ action: 'setPredicate', key: 'predicate' },
{ action: 'changeTaxCategory', key: 'taxCategory' },
{ action: 'changeActive', key: 'active' },
])
})
})
Expand Down Expand Up @@ -58,6 +59,24 @@ describe('Actions', () => {
expect(actual).toEqual(expected)
})

test('should build `changeActive` action', () => {
const before = {
active: false,
}
const now = {
active: true,
}

const actual = shippingMethodsSync.buildActions(now, before)
const expected = [
{
action: 'changeActive',
active: now.active,
},
]
expect(actual).toEqual(expected)
})

test('should build `setLocalizedName` action', () => {
const before = {
localizedName: {
Expand Down

0 comments on commit 940dd70

Please sign in to comment.