Skip to content

Commit

Permalink
feat(sync/customers): add setStores
Browse files Browse the repository at this point in the history
  • Loading branch information
adnasa committed Jan 20, 2020
1 parent 70e7ec6 commit 2403522
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/sync-actions/src/customer-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export const baseActionsList = [
key: 'defaultShippingAddressId',
actionKey: 'addressId',
},
{
action: 'setStores',
key: 'stores',
},
]

export const referenceActionsList = [
Expand Down
43 changes: 43 additions & 0 deletions packages/sync-actions/test/customer-sync.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ describe('Exports', () => {
key: 'defaultShippingAddressId',
actionKey: 'addressId',
},
{
action: 'setStores',
key: 'stores',
},
])
})

Expand Down Expand Up @@ -417,4 +421,43 @@ describe('Actions', () => {
]
expect(actual).toEqual(expected)
})

test('should build `setStores` action', () => {
const before = {
stores: [
{
typeId: 'store',
key: 'canada',
},
],
}
const now = {
stores: [
{
typeId: 'store',
key: 'canada',
},
{
typeId: 'store',
key: 'usa',
},
],
}
const actual = customerSync.buildActions(now, before)
expect(actual).toEqual([
{
action: 'setStores',
stores: [
{
typeId: 'store',
key: 'canada',
},
{
typeId: 'store',
key: 'usa',
},
],
},
])
})
})

0 comments on commit 2403522

Please sign in to comment.