Skip to content

Commit 70bc190

Browse files
committed
feat(migrate): type tests
1 parent 41fdb40 commit 70bc190

30 files changed

+105
-34
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { UpdateAction } from '@commercetools/sdk-client-v2'
22

33
export type SyncAction<T extends UpdateAction, S = {}> = {
4-
buildActions: (now: any, before: any, config: S) => Array<T>
4+
buildActions: (now: any, before: any, config?: S) => Array<T>
55
}

packages/sync-actions/test/__snapshots__/product-types-sync-attribute-hints.spec.ts.snap

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,21 @@ exports[`product type hints attribute enum values without previous when is local
9999
]
100100
`;
101101

102+
exports[`product type hints attribute enum values without previous when is truly localized should match snapshot 1`] = `
103+
[
104+
{
105+
"action": "changeLocalizedEnumValueLabel",
106+
"attributeName": "attribute-name",
107+
"newValue": {
108+
"key": "enum-key",
109+
"label": {
110+
"en-GB": "uk-label-new",
111+
},
112+
},
113+
},
114+
]
115+
`;
116+
102117
exports[`product type hints attribute hints with previous with next with changes should match snapshot 1`] = `
103118
[
104119
{

packages/sync-actions/test/attribute-groups-sync.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import attributeGroupSyncFn from '../src/attribute-groups'
22
import { baseActionsList } from '../src/attribute-groups-actions'
3+
import { AttributeGroupUpdateAction } from '@commercetools/platform-sdk/src'
4+
import { SyncAction } from '../src/types/update-actions'
35

46
describe('Exports', () => {
57
test('correctly define base actions list', () => {
@@ -12,7 +14,7 @@ describe('Exports', () => {
1214
})
1315

1416
describe('Actions', () => {
15-
let attributeGroupSync
17+
let attributeGroupSync: SyncAction<AttributeGroupUpdateAction>
1618
beforeEach(() => {
1719
attributeGroupSync = attributeGroupSyncFn()
1820
})

packages/sync-actions/test/cart-discounts-sync.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import cartDiscountsSyncFn, { actionGroups } from '../src/cart-discounts'
22
import { baseActionsList } from '../src/cart-discounts-actions'
3+
import { SyncAction } from '../src/types/update-actions'
4+
import { CartDiscountUpdateAction } from '@commercetools/platform-sdk/src'
35

46
describe('Cart Discounts Exports', () => {
57
test('action group list', () => {
@@ -109,7 +111,7 @@ describe('Cart Discounts Exports', () => {
109111
})
110112

111113
describe('Cart Discounts Actions', () => {
112-
let cartDiscountsSync
114+
let cartDiscountsSync: SyncAction<CartDiscountUpdateAction>
113115
beforeEach(() => {
114116
cartDiscountsSync = cartDiscountsSyncFn()
115117
})

packages/sync-actions/test/category-sync.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import categorySyncFn, { actionGroups } from '../src/categories'
2+
import { SyncAction } from '../src/types/update-actions'
23
import {
34
baseActionsList,
45
metaActionsList,
56
referenceActionsList,
67
} from '../src/category-actions'
8+
import { CategoryUpdateAction } from '@commercetools/platform-sdk/src'
79

810
describe('Exports', () => {
911
test('action group list', () => {
@@ -43,7 +45,7 @@ describe('Exports', () => {
4345
})
4446

4547
describe('Actions', () => {
46-
let categorySync
48+
let categorySync: SyncAction<CategoryUpdateAction>
4749
beforeEach(() => {
4850
categorySync = categorySyncFn()
4951
})

packages/sync-actions/test/channels-sync-.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import createChannelsSync, { actionGroups } from '../src/channels'
22
import { baseActionsList } from '../src/channels-actions'
3+
import { SyncAction } from '../src/types/update-actions'
4+
import { ChannelUpdateAction } from '@commercetools/platform-sdk/src'
35

46
describe('Exports', () => {
57
test('action group list', () => {
@@ -66,7 +68,7 @@ describe('Exports', () => {
6668
})
6769

6870
describe('Actions', () => {
69-
let channelsSync
71+
let channelsSync: SyncAction<ChannelUpdateAction>
7072
beforeEach(() => {
7173
channelsSync = createChannelsSync()
7274
})

packages/sync-actions/test/customer-group-sync.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import customerGroupSyncFn, { actionGroups } from '../src/customer-group'
22
import { baseActionsList } from '../src/customer-group-actions'
3+
import { SyncAction } from '../src/types/update-actions'
4+
import { CustomerGroupUpdateAction } from '@commercetools/platform-sdk/src'
35

46
describe('Customer Groups Exports', () => {
57
test('action group list', () => {
@@ -27,7 +29,7 @@ describe('Customer Groups Exports', () => {
2729
})
2830

2931
describe('Customer Groups Actions', () => {
30-
let customerGroupSync
32+
let customerGroupSync: SyncAction<CustomerGroupUpdateAction>
3133
beforeEach(() => {
3234
customerGroupSync = customerGroupSyncFn()
3335
})

packages/sync-actions/test/customer-sync.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import {
44
setDefaultBaseActionsList,
55
referenceActionsList,
66
} from '../src/customer-actions'
7+
import { SyncAction } from '../src/types/update-actions'
8+
import { CustomerUpdateAction } from '@commercetools/platform-sdk/src'
79

810
describe('Exports', () => {
911
test('action group list', () => {
@@ -64,7 +66,7 @@ describe('Exports', () => {
6466
})
6567

6668
describe('Actions', () => {
67-
let customerSync
69+
let customerSync: SyncAction<CustomerUpdateAction>
6870
beforeEach(() => {
6971
customerSync = customerSyncFn()
7072
})

packages/sync-actions/test/discount-codes-sync.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import discountCodesSyncFn, { actionGroups } from '../src/discount-codes'
22
import { baseActionsList } from '../src/discount-codes-actions'
3+
import { SyncAction } from '../src/types/update-actions'
4+
import { DiscountCodeUpdateAction } from '@commercetools/platform-sdk/src'
35

46
describe('Exports', () => {
57
test('action group list', () => {
@@ -84,7 +86,7 @@ describe('Exports', () => {
8486
})
8587

8688
describe('Actions', () => {
87-
let discountCodesSync
89+
let discountCodesSync: SyncAction<DiscountCodeUpdateAction>
8890
beforeEach(() => {
8991
discountCodesSync = discountCodesSyncFn()
9092
})

packages/sync-actions/test/inventory-sync.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import inventorySyncFn, { actionGroups } from '../src/inventories'
22
import { baseActionsList, referenceActionsList } from '../src/inventory-actions'
3+
import { SyncAction } from '../src/types/update-actions'
4+
import { InventoryEntryUpdateAction } from '@commercetools/platform-sdk/src'
35

46
describe('Exports', () => {
57
test('action group list', () => {
@@ -26,7 +28,7 @@ describe('Exports', () => {
2628
})
2729

2830
describe('Actions', () => {
29-
let inventorySync
31+
let inventorySync: SyncAction<InventoryEntryUpdateAction>
3032
beforeEach(() => {
3133
inventorySync = inventorySyncFn()
3234
})

0 commit comments

Comments
 (0)