Skip to content

Commit 6ec71c8

Browse files
committed
test(sync-actions): add test for empty categoryOrderHints
1 parent 7df9ef6 commit 6ec71c8

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

packages/sync-actions/src/product-actions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ export function actionsMapCategories(diff) {
490490

491491
export function actionsMapCategoryOrderHints(diff) {
492492
if (!diff.categoryOrderHints) return []
493-
493+
// Here we should ignore this pattern as its still no changes happened [{},0,0]
494494
return Object.keys(diff.categoryOrderHints).map((categoryId) => {
495495
const hintChange = diff.categoryOrderHints[categoryId]
496496

packages/sync-actions/test/product-sync-base.spec.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,18 @@ describe('Actions', () => {
288288
])
289289
})
290290

291+
test('shouldnt generate any categoryOrderHints actions', () => {
292+
const before = {
293+
categoryOrderHints: {},
294+
}
295+
296+
const now = {}
297+
298+
const actions = productsSync.buildActions(now, before)
299+
300+
expect(actions).toEqual([])
301+
})
302+
291303
test('should build base actions for long diff text', () => {
292304
const longText = `
293305
Lorem ipsum dolor sit amet, consectetur adipiscing elit.

0 commit comments

Comments
 (0)