@open-mercato/core 0.4.5-develop-2e9903a57a → 0.4.5-develop-eeccf7adf4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/dist/modules/auth/__integration__/TC-AUTH-001.spec.js +0 -9
- package/dist/modules/auth/__integration__/TC-AUTH-001.spec.js.map +0 -7
- package/dist/modules/auth/__integration__/TC-AUTH-002.spec.js +0 -22
- package/dist/modules/auth/__integration__/TC-AUTH-002.spec.js.map +0 -7
- package/dist/modules/auth/__integration__/TC-AUTH-003.spec.js +0 -21
- package/dist/modules/auth/__integration__/TC-AUTH-003.spec.js.map +0 -7
- package/dist/modules/auth/__integration__/TC-AUTH-004.spec.js +0 -15
- package/dist/modules/auth/__integration__/TC-AUTH-004.spec.js.map +0 -7
- package/dist/modules/auth/__integration__/TC-AUTH-005.spec.js +0 -11
- package/dist/modules/auth/__integration__/TC-AUTH-005.spec.js.map +0 -7
- package/dist/modules/auth/__integration__/TC-AUTH-006.spec.js +0 -11
- package/dist/modules/auth/__integration__/TC-AUTH-006.spec.js.map +0 -7
- package/dist/modules/auth/__integration__/TC-AUTH-007.spec.js +0 -14
- package/dist/modules/auth/__integration__/TC-AUTH-007.spec.js.map +0 -7
- package/dist/modules/auth/__integration__/TC-AUTH-008.spec.js +0 -26
- package/dist/modules/auth/__integration__/TC-AUTH-008.spec.js.map +0 -7
- package/dist/modules/auth/__integration__/TC-AUTH-009.spec.js +0 -16
- package/dist/modules/auth/__integration__/TC-AUTH-009.spec.js.map +0 -7
- package/dist/modules/auth/__integration__/TC-AUTH-010.spec.js +0 -32
- package/dist/modules/auth/__integration__/TC-AUTH-010.spec.js.map +0 -7
- package/dist/modules/auth/__integration__/TC-AUTH-011.spec.js +0 -26
- package/dist/modules/auth/__integration__/TC-AUTH-011.spec.js.map +0 -7
- package/dist/modules/auth/__integration__/TC-AUTH-012.spec.js +0 -30
- package/dist/modules/auth/__integration__/TC-AUTH-012.spec.js.map +0 -7
- package/dist/modules/auth/__integration__/TC-AUTH-013.spec.js +0 -41
- package/dist/modules/auth/__integration__/TC-AUTH-013.spec.js.map +0 -7
- package/dist/modules/auth/__integration__/TC-AUTH-014.spec.js +0 -25
- package/dist/modules/auth/__integration__/TC-AUTH-014.spec.js.map +0 -7
- package/dist/modules/auth/__integration__/TC-AUTH-015.spec.js +0 -20
- package/dist/modules/auth/__integration__/TC-AUTH-015.spec.js.map +0 -7
- package/dist/modules/auth/__integration__/TC-AUTH-016.spec.js +0 -76
- package/dist/modules/auth/__integration__/TC-AUTH-016.spec.js.map +0 -7
- package/dist/modules/catalog/__integration__/TC-CAT-001.spec.js +0 -20
- package/dist/modules/catalog/__integration__/TC-CAT-001.spec.js.map +0 -7
- package/dist/modules/catalog/__integration__/TC-CAT-002.spec.js +0 -12
- package/dist/modules/catalog/__integration__/TC-CAT-002.spec.js.map +0 -7
- package/dist/modules/catalog/__integration__/TC-CAT-003.spec.js +0 -28
- package/dist/modules/catalog/__integration__/TC-CAT-003.spec.js.map +0 -7
- package/dist/modules/catalog/__integration__/TC-CAT-004.spec.js +0 -33
- package/dist/modules/catalog/__integration__/TC-CAT-004.spec.js.map +0 -7
- package/dist/modules/catalog/__integration__/TC-CAT-005.spec.js +0 -30
- package/dist/modules/catalog/__integration__/TC-CAT-005.spec.js.map +0 -7
- package/dist/modules/catalog/__integration__/TC-CAT-006.spec.js +0 -31
- package/dist/modules/catalog/__integration__/TC-CAT-006.spec.js.map +0 -7
- package/dist/modules/catalog/__integration__/TC-CAT-007.spec.js +0 -31
- package/dist/modules/catalog/__integration__/TC-CAT-007.spec.js.map +0 -7
- package/dist/modules/catalog/__integration__/TC-CAT-008.spec.js +0 -65
- package/dist/modules/catalog/__integration__/TC-CAT-008.spec.js.map +0 -7
- package/dist/modules/catalog/__integration__/TC-CAT-009.spec.js +0 -31
- package/dist/modules/catalog/__integration__/TC-CAT-009.spec.js.map +0 -7
- package/dist/modules/catalog/__integration__/TC-CAT-010.spec.js +0 -28
- package/dist/modules/catalog/__integration__/TC-CAT-010.spec.js.map +0 -7
- package/dist/modules/catalog/__integration__/TC-CAT-011.spec.js +0 -34
- package/dist/modules/catalog/__integration__/TC-CAT-011.spec.js.map +0 -7
- package/dist/modules/catalog/__integration__/TC-CAT-012.spec.js +0 -27
- package/dist/modules/catalog/__integration__/TC-CAT-012.spec.js.map +0 -7
- package/dist/modules/core/__integration__/admin/TC-ADMIN-001.spec.js +0 -44
- package/dist/modules/core/__integration__/admin/TC-ADMIN-001.spec.js.map +0 -7
- package/dist/modules/core/__integration__/admin/TC-ADMIN-002.spec.js +0 -53
- package/dist/modules/core/__integration__/admin/TC-ADMIN-002.spec.js.map +0 -7
- package/dist/modules/core/__integration__/admin/TC-ADMIN-003.spec.js +0 -26
- package/dist/modules/core/__integration__/admin/TC-ADMIN-003.spec.js.map +0 -7
- package/dist/modules/core/__integration__/admin/TC-ADMIN-004.spec.js +0 -47
- package/dist/modules/core/__integration__/admin/TC-ADMIN-004.spec.js.map +0 -7
- package/dist/modules/core/__integration__/admin/TC-ADMIN-005.spec.js +0 -33
- package/dist/modules/core/__integration__/admin/TC-ADMIN-005.spec.js.map +0 -7
- package/dist/modules/core/__integration__/admin/TC-ADMIN-006.spec.js +0 -30
- package/dist/modules/core/__integration__/admin/TC-ADMIN-006.spec.js.map +0 -7
- package/dist/modules/core/__integration__/admin/TC-ADMIN-007.spec.js +0 -36
- package/dist/modules/core/__integration__/admin/TC-ADMIN-007.spec.js.map +0 -7
- package/dist/modules/core/__integration__/admin/TC-ADMIN-008.spec.js +0 -113
- package/dist/modules/core/__integration__/admin/TC-ADMIN-008.spec.js.map +0 -7
- package/dist/modules/core/__integration__/admin/TC-ADMIN-009.spec.js +0 -25
- package/dist/modules/core/__integration__/admin/TC-ADMIN-009.spec.js.map +0 -7
- package/dist/modules/core/__integration__/admin/TC-ADMIN-010.spec.js +0 -35
- package/dist/modules/core/__integration__/admin/TC-ADMIN-010.spec.js.map +0 -7
- package/dist/modules/core/__integration__/helpers/api.js +0 -64
- package/dist/modules/core/__integration__/helpers/api.js.map +0 -7
- package/dist/modules/core/__integration__/helpers/auth.js +0 -98
- package/dist/modules/core/__integration__/helpers/auth.js.map +0 -7
- package/dist/modules/core/__integration__/helpers/authUi.js +0 -31
- package/dist/modules/core/__integration__/helpers/authUi.js.map +0 -7
- package/dist/modules/core/__integration__/helpers/catalogFixtures.js +0 -49
- package/dist/modules/core/__integration__/helpers/catalogFixtures.js.map +0 -7
- package/dist/modules/core/__integration__/helpers/crmFixtures.js +0 -73
- package/dist/modules/core/__integration__/helpers/crmFixtures.js.map +0 -7
- package/dist/modules/core/__integration__/helpers/salesFixtures.js +0 -63
- package/dist/modules/core/__integration__/helpers/salesFixtures.js.map +0 -7
- package/dist/modules/core/__integration__/helpers/salesUi.js +0 -464
- package/dist/modules/core/__integration__/helpers/salesUi.js.map +0 -7
- package/dist/modules/core/__integration__/integration/TC-INT-001.spec.js +0 -26
- package/dist/modules/core/__integration__/integration/TC-INT-001.spec.js.map +0 -7
- package/dist/modules/core/__integration__/integration/TC-INT-002.spec.js +0 -60
- package/dist/modules/core/__integration__/integration/TC-INT-002.spec.js.map +0 -7
- package/dist/modules/core/__integration__/integration/TC-INT-003.spec.js +0 -36
- package/dist/modules/core/__integration__/integration/TC-INT-003.spec.js.map +0 -7
- package/dist/modules/core/__integration__/integration/TC-INT-004.spec.js +0 -74
- package/dist/modules/core/__integration__/integration/TC-INT-004.spec.js.map +0 -7
- package/dist/modules/core/__integration__/integration/TC-INT-005.spec.js +0 -21
- package/dist/modules/core/__integration__/integration/TC-INT-005.spec.js.map +0 -7
- package/dist/modules/customers/__integration__/TC-CRM-001.spec.js +0 -32
- package/dist/modules/customers/__integration__/TC-CRM-001.spec.js.map +0 -7
- package/dist/modules/customers/__integration__/TC-CRM-002.spec.js +0 -35
- package/dist/modules/customers/__integration__/TC-CRM-002.spec.js.map +0 -7
- package/dist/modules/customers/__integration__/TC-CRM-003.spec.js +0 -40
- package/dist/modules/customers/__integration__/TC-CRM-003.spec.js.map +0 -7
- package/dist/modules/customers/__integration__/TC-CRM-004.spec.js +0 -40
- package/dist/modules/customers/__integration__/TC-CRM-004.spec.js.map +0 -7
- package/dist/modules/customers/__integration__/TC-CRM-005.spec.js +0 -37
- package/dist/modules/customers/__integration__/TC-CRM-005.spec.js.map +0 -7
- package/dist/modules/customers/__integration__/TC-CRM-006.spec.js +0 -42
- package/dist/modules/customers/__integration__/TC-CRM-006.spec.js.map +0 -7
- package/dist/modules/customers/__integration__/TC-CRM-007.spec.js +0 -44
- package/dist/modules/customers/__integration__/TC-CRM-007.spec.js.map +0 -7
- package/dist/modules/customers/__integration__/TC-CRM-008.spec.js +0 -50
- package/dist/modules/customers/__integration__/TC-CRM-008.spec.js.map +0 -7
- package/dist/modules/customers/__integration__/TC-CRM-009.spec.js +0 -33
- package/dist/modules/customers/__integration__/TC-CRM-009.spec.js.map +0 -7
- package/dist/modules/customers/__integration__/TC-CRM-010.spec.js +0 -39
- package/dist/modules/customers/__integration__/TC-CRM-010.spec.js.map +0 -7
- package/dist/modules/customers/__integration__/TC-CRM-011.spec.js +0 -37
- package/dist/modules/customers/__integration__/TC-CRM-011.spec.js.map +0 -7
- package/dist/modules/customers/__integration__/TC-CRM-012.spec.js +0 -38
- package/dist/modules/customers/__integration__/TC-CRM-012.spec.js.map +0 -7
- package/dist/modules/customers/__integration__/TC-CRM-013.spec.js +0 -43
- package/dist/modules/customers/__integration__/TC-CRM-013.spec.js.map +0 -7
- package/dist/modules/customers/__integration__/TC-CRM-014.spec.js +0 -23
- package/dist/modules/customers/__integration__/TC-CRM-014.spec.js.map +0 -7
- package/dist/modules/customers/__integration__/TC-CRM-015.spec.js +0 -63
- package/dist/modules/customers/__integration__/TC-CRM-015.spec.js.map +0 -7
- package/dist/modules/customers/__integration__/TC-CRM-016.spec.js +0 -46
- package/dist/modules/customers/__integration__/TC-CRM-016.spec.js.map +0 -7
- package/dist/modules/customers/__integration__/TC-CRM-017.spec.js +0 -29
- package/dist/modules/customers/__integration__/TC-CRM-017.spec.js.map +0 -7
- package/dist/modules/customers/__integration__/TC-CRM-018.spec.js +0 -52
- package/dist/modules/customers/__integration__/TC-CRM-018.spec.js.map +0 -7
- package/dist/modules/customers/__integration__/TC-CRM-019.spec.js +0 -37
- package/dist/modules/customers/__integration__/TC-CRM-019.spec.js.map +0 -7
- package/dist/modules/customers/__integration__/TC-CRM-020.spec.js +0 -65
- package/dist/modules/customers/__integration__/TC-CRM-020.spec.js.map +0 -7
- package/dist/modules/progress/__integration__/TC-PROG-001.spec.js +0 -51
- package/dist/modules/progress/__integration__/TC-PROG-001.spec.js.map +0 -7
- package/dist/modules/resources/__integration__/TC-INT-007.spec.js +0 -88
- package/dist/modules/resources/__integration__/TC-INT-007.spec.js.map +0 -7
- package/dist/modules/resources/__integration__/helpers/resourcesFixtures.js +0 -45
- package/dist/modules/resources/__integration__/helpers/resourcesFixtures.js.map +0 -7
- package/dist/modules/sales/__integration__/TC-SALES-001.spec.js +0 -20
- package/dist/modules/sales/__integration__/TC-SALES-001.spec.js.map +0 -7
- package/dist/modules/sales/__integration__/TC-SALES-002.spec.js +0 -31
- package/dist/modules/sales/__integration__/TC-SALES-002.spec.js.map +0 -7
- package/dist/modules/sales/__integration__/TC-SALES-003.spec.js +0 -13
- package/dist/modules/sales/__integration__/TC-SALES-003.spec.js.map +0 -7
- package/dist/modules/sales/__integration__/TC-SALES-004.spec.js +0 -14
- package/dist/modules/sales/__integration__/TC-SALES-004.spec.js.map +0 -7
- package/dist/modules/sales/__integration__/TC-SALES-005.spec.js +0 -15
- package/dist/modules/sales/__integration__/TC-SALES-005.spec.js.map +0 -7
- package/dist/modules/sales/__integration__/TC-SALES-006.spec.js +0 -20
- package/dist/modules/sales/__integration__/TC-SALES-006.spec.js.map +0 -7
- package/dist/modules/sales/__integration__/TC-SALES-007.spec.js +0 -19
- package/dist/modules/sales/__integration__/TC-SALES-007.spec.js.map +0 -7
- package/dist/modules/sales/__integration__/TC-SALES-008.spec.js +0 -7
- package/dist/modules/sales/__integration__/TC-SALES-008.spec.js.map +0 -7
- package/dist/modules/sales/__integration__/TC-SALES-009.spec.js +0 -7
- package/dist/modules/sales/__integration__/TC-SALES-009.spec.js.map +0 -7
- package/dist/modules/sales/__integration__/TC-SALES-010.spec.js +0 -16
- package/dist/modules/sales/__integration__/TC-SALES-010.spec.js.map +0 -7
- package/dist/modules/sales/__integration__/TC-SALES-011.spec.js +0 -20
- package/dist/modules/sales/__integration__/TC-SALES-011.spec.js.map +0 -7
- package/dist/modules/sales/__integration__/TC-SALES-012.spec.js +0 -7
- package/dist/modules/sales/__integration__/TC-SALES-012.spec.js.map +0 -7
- package/dist/modules/sales/__integration__/TC-SALES-013.spec.js +0 -66
- package/dist/modules/sales/__integration__/TC-SALES-013.spec.js.map +0 -7
- package/dist/modules/sales/__integration__/TC-SALES-014.spec.js +0 -13
- package/dist/modules/sales/__integration__/TC-SALES-014.spec.js.map +0 -7
- package/dist/modules/sales/__integration__/TC-SALES-015.spec.js +0 -13
- package/dist/modules/sales/__integration__/TC-SALES-015.spec.js.map +0 -7
- package/dist/modules/sales/__integration__/TC-SALES-016.spec.js +0 -13
- package/dist/modules/sales/__integration__/TC-SALES-016.spec.js.map +0 -7
- package/dist/modules/sales/__integration__/TC-SALES-017.spec.js +0 -44
- package/dist/modules/sales/__integration__/TC-SALES-017.spec.js.map +0 -7
- package/dist/modules/sales/__integration__/TC-SALES-018.spec.js +0 -18
- package/dist/modules/sales/__integration__/TC-SALES-018.spec.js.map +0 -7
- package/dist/modules/sales/__integration__/TC-SALES-019.spec.js +0 -16
- package/dist/modules/sales/__integration__/TC-SALES-019.spec.js.map +0 -7
- package/dist/modules/sales/__integration__/TC-SALES-020.spec.js +0 -75
- package/dist/modules/sales/__integration__/TC-SALES-020.spec.js.map +0 -7
- package/dist/modules/staff/__integration__/TC-INT-006.spec.js +0 -64
- package/dist/modules/staff/__integration__/TC-INT-006.spec.js.map +0 -7
- package/dist/modules/translations/__integration__/TC-TRANS-001.spec.js +0 -48
- package/dist/modules/translations/__integration__/TC-TRANS-001.spec.js.map +0 -7
- package/dist/modules/translations/__integration__/TC-TRANS-002.spec.js +0 -94
- package/dist/modules/translations/__integration__/TC-TRANS-002.spec.js.map +0 -7
- package/dist/modules/translations/__integration__/TC-TRANS-003.spec.js +0 -61
- package/dist/modules/translations/__integration__/TC-TRANS-003.spec.js.map +0 -7
- package/dist/modules/translations/__integration__/TC-TRANS-004.spec.js +0 -52
- package/dist/modules/translations/__integration__/TC-TRANS-004.spec.js.map +0 -7
- package/dist/modules/translations/__integration__/TC-TRANS-005.spec.js +0 -106
- package/dist/modules/translations/__integration__/TC-TRANS-005.spec.js.map +0 -7
- package/dist/modules/translations/__integration__/TC-TRANS-006.spec.js +0 -94
- package/dist/modules/translations/__integration__/TC-TRANS-006.spec.js.map +0 -7
- package/dist/modules/translations/__integration__/TC-TRANS-007.spec.js +0 -62
- package/dist/modules/translations/__integration__/TC-TRANS-007.spec.js.map +0 -7
- package/dist/modules/translations/__integration__/TC-TRANS-008.spec.js +0 -168
- package/dist/modules/translations/__integration__/TC-TRANS-008.spec.js.map +0 -7
- package/dist/modules/translations/__integration__/helpers/translationFixtures.js +0 -63
- package/dist/modules/translations/__integration__/helpers/translationFixtures.js.map +0 -7
- package/dist/modules/workflows/__integration__/TC-WF-001.spec.js +0 -73
- package/dist/modules/workflows/__integration__/TC-WF-001.spec.js.map +0 -7
- package/src/__tests__/module-decoupling.test.ts +0 -356
- package/src/modules/api_keys/api/__tests__/keys.route.test.ts +0 -244
- package/src/modules/attachments/api/__tests__/attachments.api.test.ts +0 -240
- package/src/modules/attachments/components/__tests__/AttachmentContentPreview.test.tsx +0 -45
- package/src/modules/attachments/data/__tests__/entities-ocr.test.ts +0 -15
- package/src/modules/attachments/lib/__tests__/ocr-config.test.ts +0 -27
- package/src/modules/attachments/lib/__tests__/textExtraction.test.ts +0 -64
- package/src/modules/audit_logs/api/__tests__/access.route.test.ts +0 -118
- package/src/modules/audit_logs/api/__tests__/redo.route.test.ts +0 -131
- package/src/modules/audit_logs/api/__tests__/undo.route.test.ts +0 -103
- package/src/modules/audit_logs/services/__tests__/actionLogService.test.ts +0 -26
- package/src/modules/auth/__integration__/TC-AUTH-001.spec.ts +0 -13
- package/src/modules/auth/__integration__/TC-AUTH-002.spec.ts +0 -30
- package/src/modules/auth/__integration__/TC-AUTH-003.spec.ts +0 -28
- package/src/modules/auth/__integration__/TC-AUTH-004.spec.ts +0 -21
- package/src/modules/auth/__integration__/TC-AUTH-005.spec.ts +0 -17
- package/src/modules/auth/__integration__/TC-AUTH-006.spec.ts +0 -17
- package/src/modules/auth/__integration__/TC-AUTH-007.spec.ts +0 -19
- package/src/modules/auth/__integration__/TC-AUTH-008.spec.ts +0 -31
- package/src/modules/auth/__integration__/TC-AUTH-009.spec.ts +0 -22
- package/src/modules/auth/__integration__/TC-AUTH-010.spec.ts +0 -39
- package/src/modules/auth/__integration__/TC-AUTH-011.spec.ts +0 -35
- package/src/modules/auth/__integration__/TC-AUTH-012.spec.ts +0 -36
- package/src/modules/auth/__integration__/TC-AUTH-013.spec.ts +0 -48
- package/src/modules/auth/__integration__/TC-AUTH-014.spec.ts +0 -31
- package/src/modules/auth/__integration__/TC-AUTH-015.spec.ts +0 -28
- package/src/modules/auth/__integration__/TC-AUTH-016.spec.ts +0 -109
- package/src/modules/auth/__tests__/cli-rotate-encryption.test.ts +0 -97
- package/src/modules/auth/__tests__/cli-setup-acl.test.ts +0 -148
- package/src/modules/auth/api/__tests__/feature-check.test.ts +0 -65
- package/src/modules/auth/api/__tests__/login.test.ts +0 -47
- package/src/modules/auth/commands/__tests__/roles.custom-fields.test.ts +0 -126
- package/src/modules/auth/commands/__tests__/users.custom-fields.test.ts +0 -147
- package/src/modules/auth/lib/__tests__/rateLimitCheck.test.ts +0 -224
- package/src/modules/auth/services/__tests__/authService.test.ts +0 -32
- package/src/modules/auth/services/__tests__/rbacService.test.ts +0 -814
- package/src/modules/business_rules/api/__tests__/execute.route.test.ts +0 -311
- package/src/modules/business_rules/api/__tests__/logs-detail.route.test.ts +0 -181
- package/src/modules/business_rules/api/__tests__/logs.route.test.ts +0 -261
- package/src/modules/business_rules/api/__tests__/rules-detail.route.test.ts +0 -115
- package/src/modules/business_rules/api/__tests__/rules.route.test.ts +0 -746
- package/src/modules/business_rules/api/__tests__/sets-detail.route.test.ts +0 -169
- package/src/modules/business_rules/api/__tests__/sets-members.route.test.ts +0 -367
- package/src/modules/business_rules/api/__tests__/sets.route.test.ts +0 -361
- package/src/modules/business_rules/api/__tests__/test-helpers.ts +0 -42
- package/src/modules/business_rules/components/utils/__tests__/formHelpers.test.ts +0 -69
- package/src/modules/business_rules/data/__tests__/validators.test.ts +0 -637
- package/src/modules/business_rules/lib/__tests__/action-executor.test.ts +0 -728
- package/src/modules/business_rules/lib/__tests__/expression-evaluator.test.ts +0 -592
- package/src/modules/business_rules/lib/__tests__/rule-engine.test.ts +0 -805
- package/src/modules/business_rules/lib/__tests__/rule-evaluator.test.ts +0 -436
- package/src/modules/catalog/__integration__/TC-CAT-001.spec.ts +0 -32
- package/src/modules/catalog/__integration__/TC-CAT-002.spec.ts +0 -19
- package/src/modules/catalog/__integration__/TC-CAT-003.spec.ts +0 -39
- package/src/modules/catalog/__integration__/TC-CAT-004.spec.ts +0 -41
- package/src/modules/catalog/__integration__/TC-CAT-005.spec.ts +0 -37
- package/src/modules/catalog/__integration__/TC-CAT-006.spec.ts +0 -40
- package/src/modules/catalog/__integration__/TC-CAT-007.spec.ts +0 -37
- package/src/modules/catalog/__integration__/TC-CAT-008.spec.ts +0 -76
- package/src/modules/catalog/__integration__/TC-CAT-009.spec.ts +0 -39
- package/src/modules/catalog/__integration__/TC-CAT-010.spec.ts +0 -36
- package/src/modules/catalog/__integration__/TC-CAT-011.spec.ts +0 -44
- package/src/modules/catalog/__integration__/TC-CAT-012.spec.ts +0 -35
- package/src/modules/catalog/api/__tests__/offers.route.test.ts +0 -161
- package/src/modules/catalog/api/__tests__/prices.route.test.ts +0 -39
- package/src/modules/catalog/api/__tests__/products.route.test.ts +0 -91
- package/src/modules/catalog/api/__tests__/utils.test.ts +0 -36
- package/src/modules/catalog/api/__tests__/variants.route.test.ts +0 -44
- package/src/modules/catalog/backend/catalog/products/__tests__/ProductsDataTable.test.tsx +0 -172
- package/src/modules/catalog/commands/__tests__/products.delete.test.ts +0 -146
- package/src/modules/catalog/commands/__tests__/products.update.test.ts +0 -142
- package/src/modules/catalog/commands/__tests__/registration.test.ts +0 -54
- package/src/modules/catalog/commands/__tests__/shared.test.ts +0 -129
- package/src/modules/catalog/components/__tests__/catalogComponentsRender.test.tsx +0 -373
- package/src/modules/catalog/components/products/__tests__/ProductImageCell.test.tsx +0 -51
- package/src/modules/catalog/components/products/__tests__/productForm.test.ts +0 -32
- package/src/modules/catalog/lib/__tests__/pricing.test.ts +0 -150
- package/src/modules/catalog/services/__tests__/catalogPricingService.test.ts +0 -21
- package/src/modules/configs/components/__tests__/CachePanel.test.tsx +0 -134
- package/src/modules/configs/components/__tests__/SystemStatusPanel.test.tsx +0 -93
- package/src/modules/configs/lib/__tests__/system-status.test.ts +0 -55
- package/src/modules/configs/lib/__tests__/upgrade-actions.test.ts +0 -135
- package/src/modules/core/__integration__/admin/TC-ADMIN-001.spec.ts +0 -70
- package/src/modules/core/__integration__/admin/TC-ADMIN-002.spec.ts +0 -83
- package/src/modules/core/__integration__/admin/TC-ADMIN-003.spec.ts +0 -50
- package/src/modules/core/__integration__/admin/TC-ADMIN-004.spec.ts +0 -77
- package/src/modules/core/__integration__/admin/TC-ADMIN-005.spec.ts +0 -49
- package/src/modules/core/__integration__/admin/TC-ADMIN-006.spec.ts +0 -59
- package/src/modules/core/__integration__/admin/TC-ADMIN-007.spec.ts +0 -68
- package/src/modules/core/__integration__/admin/TC-ADMIN-008.spec.ts +0 -127
- package/src/modules/core/__integration__/admin/TC-ADMIN-009.spec.ts +0 -48
- package/src/modules/core/__integration__/admin/TC-ADMIN-010.spec.ts +0 -57
- package/src/modules/core/__integration__/helpers/api.ts +0 -84
- package/src/modules/core/__integration__/helpers/auth.ts +0 -110
- package/src/modules/core/__integration__/helpers/authUi.ts +0 -33
- package/src/modules/core/__integration__/helpers/catalogFixtures.ts +0 -73
- package/src/modules/core/__integration__/helpers/crmFixtures.ts +0 -101
- package/src/modules/core/__integration__/helpers/salesFixtures.ts +0 -89
- package/src/modules/core/__integration__/helpers/salesUi.ts +0 -528
- package/src/modules/core/__integration__/integration/TC-INT-001.spec.ts +0 -34
- package/src/modules/core/__integration__/integration/TC-INT-002.spec.ts +0 -74
- package/src/modules/core/__integration__/integration/TC-INT-003.spec.ts +0 -43
- package/src/modules/core/__integration__/integration/TC-INT-004.spec.ts +0 -82
- package/src/modules/core/__integration__/integration/TC-INT-005.spec.ts +0 -29
- package/src/modules/currencies/backend/exchange-rates/__tests__/formatDateTimeLocal.test.ts +0 -78
- package/src/modules/currencies/data/__tests__/validators.test.ts +0 -100
- package/src/modules/currencies/services/__tests__/exchangeRateService.test.ts +0 -666
- package/src/modules/currencies/services/__tests__/rateFetchingService.basic.test.ts +0 -398
- package/src/modules/currencies/services/__tests__/rateFetchingService.errors.test.ts +0 -296
- package/src/modules/currencies/services/__tests__/rateFetchingService.providers.test.ts +0 -350
- package/src/modules/currencies/services/__tests__/rateFetchingService.setup.ts +0 -188
- package/src/modules/customers/__integration__/TC-CRM-001.spec.ts +0 -42
- package/src/modules/customers/__integration__/TC-CRM-002.spec.ts +0 -47
- package/src/modules/customers/__integration__/TC-CRM-003.spec.ts +0 -55
- package/src/modules/customers/__integration__/TC-CRM-004.spec.ts +0 -57
- package/src/modules/customers/__integration__/TC-CRM-005.spec.ts +0 -50
- package/src/modules/customers/__integration__/TC-CRM-006.spec.ts +0 -60
- package/src/modules/customers/__integration__/TC-CRM-007.spec.ts +0 -57
- package/src/modules/customers/__integration__/TC-CRM-008.spec.ts +0 -62
- package/src/modules/customers/__integration__/TC-CRM-009.spec.ts +0 -46
- package/src/modules/customers/__integration__/TC-CRM-010.spec.ts +0 -49
- package/src/modules/customers/__integration__/TC-CRM-011.spec.ts +0 -47
- package/src/modules/customers/__integration__/TC-CRM-012.spec.ts +0 -49
- package/src/modules/customers/__integration__/TC-CRM-013.spec.ts +0 -61
- package/src/modules/customers/__integration__/TC-CRM-014.spec.ts +0 -31
- package/src/modules/customers/__integration__/TC-CRM-015.spec.ts +0 -89
- package/src/modules/customers/__integration__/TC-CRM-016.spec.ts +0 -55
- package/src/modules/customers/__integration__/TC-CRM-017.spec.ts +0 -37
- package/src/modules/customers/__integration__/TC-CRM-018.spec.ts +0 -62
- package/src/modules/customers/__integration__/TC-CRM-019.spec.ts +0 -44
- package/src/modules/customers/__integration__/TC-CRM-020.spec.ts +0 -73
- package/src/modules/customers/api/__tests__/utils.test.ts +0 -61
- package/src/modules/customers/api/dashboard/widgets/new-deals/__tests__/route.test.ts +0 -54
- package/src/modules/customers/commands/__tests__/shared.test.ts +0 -263
- package/src/modules/customers/commands/__tests__/undo.custom-fields.test.ts +0 -1184
- package/src/modules/customers/components/detail/__tests__/ActivityForm.validation.test.ts +0 -37
- package/src/modules/customers/components/detail/__tests__/DealForm.validation.test.ts +0 -45
- package/src/modules/customers/components/detail/__tests__/InlineEditors.test.tsx +0 -166
- package/src/modules/customers/components/detail/__tests__/TaskForm.submit.test.ts +0 -21
- package/src/modules/customers/components/detail/hooks/__tests__/useCustomerDictionary.test.ts +0 -97
- package/src/modules/customers/lib/__tests__/customFieldRouting.test.ts +0 -107
- package/src/modules/customers/utils/__tests__/addressFormat.test.ts +0 -105
- package/src/modules/customers/utils/__tests__/phoneDuplicates.test.ts +0 -98
- package/src/modules/dashboards/__tests__/widgets.test.ts +0 -70
- package/src/modules/dashboards/lib/__tests__/aggregations.test.ts +0 -328
- package/src/modules/dashboards/lib/__tests__/formatters.test.ts +0 -128
- package/src/modules/directory/backend/directory/organizations/__tests__/create-submit.test.ts +0 -46
- package/src/modules/directory/backend/directory/organizations/__tests__/edit-submit.test.ts +0 -49
- package/src/modules/directory/components/__tests__/OrganizationSelect.test.tsx +0 -71
- package/src/modules/directory/components/__tests__/TenantSelect.test.tsx +0 -75
- package/src/modules/entities/__tests__/cli-decrypt-database.test.ts +0 -534
- package/src/modules/entities/__tests__/cli-rotate-encryption.test.ts +0 -123
- package/src/modules/entities/api/__tests__/encryption.api.test.ts +0 -57
- package/src/modules/entities/api/__tests__/records.get.custom-entity.test.ts +0 -43
- package/src/modules/entities/api/__tests__/records.validation.test.ts +0 -53
- package/src/modules/entities/backend/entities/user/__tests__/create-entity-submit.test.ts +0 -47
- package/src/modules/entities/backend/entities/user/__tests__/records-submit.test.ts +0 -104
- package/src/modules/feature_toggles/commands/__tests__/global.test.ts +0 -325
- package/src/modules/feature_toggles/commands/__tests__/overrides.test.ts +0 -186
- package/src/modules/feature_toggles/lib/__tests__/feature-flag-check.test.ts +0 -365
- package/src/modules/feature_toggles/lib/__tests__/queries.test.ts +0 -130
- package/src/modules/inbox_ops/api/emails/[id]/reprocess/__tests__/route.test.ts +0 -194
- package/src/modules/inbox_ops/api/proposals/[id]/__tests__/route.test.ts +0 -124
- package/src/modules/inbox_ops/api/proposals/[id]/accept-all/__tests__/route.test.ts +0 -154
- package/src/modules/inbox_ops/api/proposals/[id]/actions/[actionId]/__tests__/route.test.ts +0 -200
- package/src/modules/inbox_ops/api/proposals/[id]/actions/[actionId]/accept/__tests__/route.test.ts +0 -261
- package/src/modules/inbox_ops/api/proposals/[id]/actions/[actionId]/reject/__tests__/route.test.ts +0 -201
- package/src/modules/inbox_ops/api/proposals/[id]/reject/__tests__/route.test.ts +0 -123
- package/src/modules/inbox_ops/api/proposals/[id]/replies/[replyId]/send/__tests__/route.test.ts +0 -232
- package/src/modules/inbox_ops/api/proposals/[id]/translate/__tests__/route.test.ts +0 -173
- package/src/modules/inbox_ops/api/proposals/__tests__/route.test.ts +0 -185
- package/src/modules/inbox_ops/api/webhook/__tests__/inbound.test.ts +0 -317
- package/src/modules/inbox_ops/data/__tests__/validators.test.ts +0 -463
- package/src/modules/inbox_ops/lib/__tests__/catalogLookup.test.ts +0 -143
- package/src/modules/inbox_ops/lib/__tests__/contactMatcher.test.ts +0 -158
- package/src/modules/inbox_ops/lib/__tests__/emailParser.test.ts +0 -191
- package/src/modules/inbox_ops/lib/__tests__/executionEngine.test.ts +0 -1419
- package/src/modules/inbox_ops/lib/__tests__/extractionPrompt.test.ts +0 -151
- package/src/modules/inbox_ops/lib/__tests__/priceValidator.test.ts +0 -259
- package/src/modules/inbox_ops/lib/__tests__/translationProvider.test.ts +0 -99
- package/src/modules/inbox_ops/subscribers/__tests__/extractionWorker.test.ts +0 -803
- package/src/modules/notifications/__tests__/deliver-notification.test.ts +0 -285
- package/src/modules/notifications/__tests__/deliveryStrategies.test.ts +0 -19
- package/src/modules/notifications/__tests__/notificationService.test.ts +0 -248
- package/src/modules/planner/__tests__/availabilityMerge.test.ts +0 -99
- package/src/modules/planner/__tests__/plannerAvailabilityService.test.ts +0 -89
- package/src/modules/planner/data/__tests__/validators.test.ts +0 -78
- package/src/modules/progress/__integration__/TC-PROG-001.spec.ts +0 -67
- package/src/modules/progress/__tests__/progressService.test.ts +0 -377
- package/src/modules/query_index/__tests__/hybrid-engine.test.ts +0 -365
- package/src/modules/query_index/__tests__/indexer.test.ts +0 -175
- package/src/modules/resources/__integration__/TC-INT-007.spec.ts +0 -110
- package/src/modules/resources/__integration__/helpers/resourcesFixtures.ts +0 -50
- package/src/modules/resources/data/__tests__/validators.test.ts +0 -65
- package/src/modules/sales/__integration__/TC-SALES-001.spec.ts +0 -26
- package/src/modules/sales/__integration__/TC-SALES-002.spec.ts +0 -38
- package/src/modules/sales/__integration__/TC-SALES-003.spec.ts +0 -18
- package/src/modules/sales/__integration__/TC-SALES-004.spec.ts +0 -19
- package/src/modules/sales/__integration__/TC-SALES-005.spec.ts +0 -21
- package/src/modules/sales/__integration__/TC-SALES-006.spec.ts +0 -26
- package/src/modules/sales/__integration__/TC-SALES-007.spec.ts +0 -23
- package/src/modules/sales/__integration__/TC-SALES-008.spec.ts +0 -11
- package/src/modules/sales/__integration__/TC-SALES-009.spec.ts +0 -12
- package/src/modules/sales/__integration__/TC-SALES-010.spec.ts +0 -20
- package/src/modules/sales/__integration__/TC-SALES-011.spec.ts +0 -26
- package/src/modules/sales/__integration__/TC-SALES-012.spec.ts +0 -12
- package/src/modules/sales/__integration__/TC-SALES-013.spec.ts +0 -73
- package/src/modules/sales/__integration__/TC-SALES-014.spec.ts +0 -17
- package/src/modules/sales/__integration__/TC-SALES-015.spec.ts +0 -17
- package/src/modules/sales/__integration__/TC-SALES-016.spec.ts +0 -17
- package/src/modules/sales/__integration__/TC-SALES-017.spec.ts +0 -60
- package/src/modules/sales/__integration__/TC-SALES-018.spec.ts +0 -25
- package/src/modules/sales/__integration__/TC-SALES-019.spec.ts +0 -22
- package/src/modules/sales/__integration__/TC-SALES-020.spec.ts +0 -107
- package/src/modules/sales/api/__tests__/channels.route.test.ts +0 -50
- package/src/modules/sales/api/__tests__/document-history.test.ts +0 -146
- package/src/modules/sales/api/__tests__/documents.factory.test.ts +0 -98
- package/src/modules/sales/api/__tests__/documents.routes.test.ts +0 -149
- package/src/modules/sales/api/__tests__/quotes.acceptance.test.ts +0 -209
- package/src/modules/sales/api/__tests__/timeline.test.tsx +0 -165
- package/src/modules/sales/api/dashboard/widgets/new-orders/__tests__/route.test.ts +0 -112
- package/src/modules/sales/api/dashboard/widgets/new-quotes/__tests__/route.test.ts +0 -116
- package/src/modules/sales/commands/__tests__/documents.cache.test.ts +0 -126
- package/src/modules/sales/commands/__tests__/documents.undo.test.ts +0 -170
- package/src/modules/sales/commands/__tests__/registration.test.ts +0 -141
- package/src/modules/sales/components/__tests__/salesComponentsRender.test.tsx +0 -456
- package/src/modules/sales/lib/__tests__/calculations.test.ts +0 -210
- package/src/modules/sales/services/__tests__/salesCalculationService.test.ts +0 -181
- package/src/modules/sales/services/__tests__/taxCalculationService.test.ts +0 -79
- package/src/modules/sales/widgets/dashboard/new-orders/__tests__/config.test.ts +0 -47
- package/src/modules/sales/widgets/dashboard/new-quotes/__tests__/config.test.ts +0 -47
- package/src/modules/staff/__integration__/TC-INT-006.spec.ts +0 -71
- package/src/modules/staff/data/__tests__/validators.test.ts +0 -60
- package/src/modules/translations/__integration__/TC-TRANS-001.spec.ts +0 -57
- package/src/modules/translations/__integration__/TC-TRANS-002.spec.ts +0 -114
- package/src/modules/translations/__integration__/TC-TRANS-003.spec.ts +0 -71
- package/src/modules/translations/__integration__/TC-TRANS-004.spec.ts +0 -66
- package/src/modules/translations/__integration__/TC-TRANS-005.spec.ts +0 -135
- package/src/modules/translations/__integration__/TC-TRANS-006.spec.ts +0 -113
- package/src/modules/translations/__integration__/TC-TRANS-007.spec.ts +0 -80
- package/src/modules/translations/__integration__/TC-TRANS-008.spec.ts +0 -209
- package/src/modules/translations/__integration__/helpers/translationFixtures.ts +0 -95
- package/src/modules/translations/api/__tests__/locales.test.ts +0 -67
- package/src/modules/translations/data/__tests__/validators.test.ts +0 -143
- package/src/modules/translations/lib/__tests__/extract-record-id.test.ts +0 -75
- package/src/modules/translations/lib/__tests__/helpers.test.ts +0 -215
- package/src/modules/translations/lib/__tests__/locale.test.ts +0 -115
- package/src/modules/translations/lib/__tests__/resolve-field-list.test.ts +0 -176
- package/src/modules/translations/lib/__tests__/translatable-fields.test.ts +0 -79
- package/src/modules/translations/widgets/__tests__/injection-table.test.ts +0 -83
- package/src/modules/workflows/__integration__/TC-WF-001.spec.ts +0 -114
- package/src/modules/workflows/api/__tests__/definitions.route.test.ts +0 -762
- package/src/modules/workflows/api/__tests__/instances.route.test.ts +0 -869
- package/src/modules/workflows/data/__tests__/validators.test.ts +0 -707
- package/src/modules/workflows/lib/__tests__/activity-executor.test.ts +0 -1230
- package/src/modules/workflows/lib/__tests__/call-api.test.ts +0 -421
- package/src/modules/workflows/lib/__tests__/compensation.test.ts +0 -713
- package/src/modules/workflows/lib/__tests__/event-logger.test.ts +0 -615
- package/src/modules/workflows/lib/__tests__/integration.test.ts +0 -693
- package/src/modules/workflows/lib/__tests__/signals.test.ts +0 -566
- package/src/modules/workflows/lib/__tests__/step-handler.test.ts +0 -670
- package/src/modules/workflows/lib/__tests__/sub-workflow.test.ts +0 -934
- package/src/modules/workflows/lib/__tests__/transition-handler.test.ts +0 -925
- package/src/modules/workflows/lib/__tests__/workflow-executor.test.ts +0 -684
|
@@ -1,1230 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Activity Executor Unit Tests
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { EntityManager } from '@mikro-orm/core'
|
|
6
|
-
import type { AwilixContainer } from 'awilix'
|
|
7
|
-
import { WorkflowInstance } from '../../data/entities'
|
|
8
|
-
import * as activityExecutor from '../activity-executor'
|
|
9
|
-
import type { ActivityDefinition, ActivityContext } from '../activity-executor'
|
|
10
|
-
|
|
11
|
-
// Mock global fetch
|
|
12
|
-
global.fetch = jest.fn()
|
|
13
|
-
|
|
14
|
-
describe('Activity Executor (Unit Tests)', () => {
|
|
15
|
-
let mockEm: jest.Mocked<EntityManager>
|
|
16
|
-
let mockContainer: jest.Mocked<AwilixContainer>
|
|
17
|
-
let mockInstance: WorkflowInstance
|
|
18
|
-
let mockContext: ActivityContext
|
|
19
|
-
|
|
20
|
-
const testInstanceId = 'test-instance-id'
|
|
21
|
-
const testTenantId = 'test-tenant-id'
|
|
22
|
-
const testOrgId = 'test-org-id'
|
|
23
|
-
|
|
24
|
-
beforeEach(() => {
|
|
25
|
-
// Create mock EntityManager
|
|
26
|
-
mockEm = {
|
|
27
|
-
findOne: jest.fn(),
|
|
28
|
-
find: jest.fn(),
|
|
29
|
-
create: jest.fn(),
|
|
30
|
-
persistAndFlush: jest.fn(),
|
|
31
|
-
flush: jest.fn(),
|
|
32
|
-
} as any
|
|
33
|
-
|
|
34
|
-
// Create mock DI container
|
|
35
|
-
mockContainer = {
|
|
36
|
-
resolve: jest.fn(),
|
|
37
|
-
} as any
|
|
38
|
-
|
|
39
|
-
// Create mock workflow instance
|
|
40
|
-
mockInstance = {
|
|
41
|
-
id: testInstanceId,
|
|
42
|
-
definitionId: 'test-definition-id',
|
|
43
|
-
workflowId: 'test-workflow',
|
|
44
|
-
version: 1,
|
|
45
|
-
currentStepId: 'step-1',
|
|
46
|
-
status: 'RUNNING',
|
|
47
|
-
context: {
|
|
48
|
-
user: { email: 'user@example.com', name: 'John Doe' },
|
|
49
|
-
orderId: 'order-123',
|
|
50
|
-
},
|
|
51
|
-
startedAt: new Date(),
|
|
52
|
-
retryCount: 0,
|
|
53
|
-
tenantId: testTenantId,
|
|
54
|
-
organizationId: testOrgId,
|
|
55
|
-
createdAt: new Date(),
|
|
56
|
-
updatedAt: new Date(),
|
|
57
|
-
} as WorkflowInstance
|
|
58
|
-
|
|
59
|
-
// Create mock context
|
|
60
|
-
mockContext = {
|
|
61
|
-
workflowInstance: mockInstance,
|
|
62
|
-
workflowContext: mockInstance.context,
|
|
63
|
-
userId: 'user-123',
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Reset mocks
|
|
67
|
-
jest.clearAllMocks()
|
|
68
|
-
;(global.fetch as jest.Mock).mockClear()
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
// ============================================================================
|
|
72
|
-
// SEND_EMAIL Activity Tests
|
|
73
|
-
// ============================================================================
|
|
74
|
-
|
|
75
|
-
describe('SEND_EMAIL activity', () => {
|
|
76
|
-
test('should execute SEND_EMAIL activity successfully (console mode)', async () => {
|
|
77
|
-
const activity: ActivityDefinition = {
|
|
78
|
-
activityId: 'activity-1',
|
|
79
|
-
activityName: 'Welcome Email',
|
|
80
|
-
activityType: 'SEND_EMAIL',
|
|
81
|
-
config: {
|
|
82
|
-
to: 'user@example.com',
|
|
83
|
-
subject: 'Welcome!',
|
|
84
|
-
body: 'Welcome to our service',
|
|
85
|
-
},
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// No email service available
|
|
89
|
-
mockContainer.resolve.mockImplementation(() => {
|
|
90
|
-
throw new Error('emailService not registered')
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
const consoleSpy = jest.spyOn(console, 'log').mockImplementation()
|
|
94
|
-
|
|
95
|
-
const result = await activityExecutor.executeActivity(
|
|
96
|
-
mockEm,
|
|
97
|
-
mockContainer,
|
|
98
|
-
activity,
|
|
99
|
-
mockContext
|
|
100
|
-
)
|
|
101
|
-
|
|
102
|
-
expect(result.success).toBe(true)
|
|
103
|
-
expect(result.output.sent).toBe(true)
|
|
104
|
-
expect(result.output.to).toBe('user@example.com')
|
|
105
|
-
expect(result.output.via).toBe('console')
|
|
106
|
-
expect(consoleSpy).toHaveBeenCalledWith(
|
|
107
|
-
expect.stringContaining('Send email to user@example.com')
|
|
108
|
-
)
|
|
109
|
-
|
|
110
|
-
consoleSpy.mockRestore()
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
test('should execute SEND_EMAIL with email service if available', async () => {
|
|
114
|
-
const mockEmailService = {
|
|
115
|
-
send: jest.fn().mockResolvedValue({ messageId: 'msg-123' }),
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
mockContainer.resolve.mockReturnValue(mockEmailService)
|
|
119
|
-
|
|
120
|
-
const activity: ActivityDefinition = {
|
|
121
|
-
activityId: 'activity-2',
|
|
122
|
-
activityName: 'Welcome Email',
|
|
123
|
-
activityType: 'SEND_EMAIL',
|
|
124
|
-
config: {
|
|
125
|
-
to: 'user@example.com',
|
|
126
|
-
subject: 'Welcome!',
|
|
127
|
-
template: 'welcome',
|
|
128
|
-
templateData: { name: 'John' },
|
|
129
|
-
},
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const result = await activityExecutor.executeActivity(
|
|
133
|
-
mockEm,
|
|
134
|
-
mockContainer,
|
|
135
|
-
activity,
|
|
136
|
-
mockContext
|
|
137
|
-
)
|
|
138
|
-
|
|
139
|
-
expect(result.success).toBe(true)
|
|
140
|
-
expect(result.output.via).toBe('emailService')
|
|
141
|
-
expect(mockEmailService.send).toHaveBeenCalledWith({
|
|
142
|
-
to: 'user@example.com',
|
|
143
|
-
subject: 'Welcome!',
|
|
144
|
-
template: 'welcome',
|
|
145
|
-
templateData: { name: 'John' },
|
|
146
|
-
body: undefined,
|
|
147
|
-
})
|
|
148
|
-
})
|
|
149
|
-
|
|
150
|
-
test('should fail SEND_EMAIL if missing required fields', async () => {
|
|
151
|
-
const activity: ActivityDefinition = {
|
|
152
|
-
activityId: 'activity-3',
|
|
153
|
-
activityName: 'Invalid Email',
|
|
154
|
-
activityType: 'SEND_EMAIL',
|
|
155
|
-
config: {
|
|
156
|
-
to: 'user@example.com',
|
|
157
|
-
// Missing subject
|
|
158
|
-
},
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
mockContainer.resolve.mockImplementation(() => {
|
|
162
|
-
throw new Error('emailService not registered')
|
|
163
|
-
})
|
|
164
|
-
|
|
165
|
-
const result = await activityExecutor.executeActivity(
|
|
166
|
-
mockEm,
|
|
167
|
-
mockContainer,
|
|
168
|
-
activity,
|
|
169
|
-
mockContext
|
|
170
|
-
)
|
|
171
|
-
|
|
172
|
-
expect(result.success).toBe(false)
|
|
173
|
-
expect(result.error).toContain('requires "to" and "subject"')
|
|
174
|
-
})
|
|
175
|
-
|
|
176
|
-
test('should interpolate variables in SEND_EMAIL config', async () => {
|
|
177
|
-
const activity: ActivityDefinition = {
|
|
178
|
-
activityId: 'activity-4',
|
|
179
|
-
activityName: 'Dynamic Email',
|
|
180
|
-
activityType: 'SEND_EMAIL',
|
|
181
|
-
config: {
|
|
182
|
-
to: '{{user.email}}',
|
|
183
|
-
subject: 'Hello {{user.name}}',
|
|
184
|
-
body: 'Your order {{orderId}} is ready',
|
|
185
|
-
},
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
mockContainer.resolve.mockImplementation(() => {
|
|
189
|
-
throw new Error('emailService not registered')
|
|
190
|
-
})
|
|
191
|
-
|
|
192
|
-
const consoleSpy = jest.spyOn(console, 'log').mockImplementation()
|
|
193
|
-
|
|
194
|
-
const result = await activityExecutor.executeActivity(
|
|
195
|
-
mockEm,
|
|
196
|
-
mockContainer,
|
|
197
|
-
activity,
|
|
198
|
-
mockContext
|
|
199
|
-
)
|
|
200
|
-
|
|
201
|
-
expect(result.success).toBe(true)
|
|
202
|
-
expect(result.output.to).toBe('user@example.com')
|
|
203
|
-
expect(result.output.subject).toBe('Hello John Doe')
|
|
204
|
-
expect(consoleSpy).toHaveBeenCalledWith(
|
|
205
|
-
expect.stringContaining('user@example.com: Hello John Doe')
|
|
206
|
-
)
|
|
207
|
-
|
|
208
|
-
consoleSpy.mockRestore()
|
|
209
|
-
})
|
|
210
|
-
})
|
|
211
|
-
|
|
212
|
-
// ============================================================================
|
|
213
|
-
// EMIT_EVENT Activity Tests
|
|
214
|
-
// ============================================================================
|
|
215
|
-
|
|
216
|
-
describe('EMIT_EVENT activity', () => {
|
|
217
|
-
test('should execute EMIT_EVENT activity successfully', async () => {
|
|
218
|
-
const mockEventBus = {
|
|
219
|
-
emitEvent: jest.fn().mockResolvedValue(undefined),
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
mockContainer.resolve.mockReturnValue(mockEventBus)
|
|
223
|
-
|
|
224
|
-
const activity: ActivityDefinition = {
|
|
225
|
-
activityId: 'activity-5',
|
|
226
|
-
activityName: 'Order Created Event',
|
|
227
|
-
activityType: 'EMIT_EVENT',
|
|
228
|
-
config: {
|
|
229
|
-
eventName: 'order.created',
|
|
230
|
-
payload: {
|
|
231
|
-
orderId: 'order-123',
|
|
232
|
-
status: 'pending',
|
|
233
|
-
},
|
|
234
|
-
},
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
const result = await activityExecutor.executeActivity(
|
|
238
|
-
mockEm,
|
|
239
|
-
mockContainer,
|
|
240
|
-
activity,
|
|
241
|
-
mockContext
|
|
242
|
-
)
|
|
243
|
-
|
|
244
|
-
expect(result.success).toBe(true)
|
|
245
|
-
expect(result.output.emitted).toBe(true)
|
|
246
|
-
expect(result.output.eventName).toBe('order.created')
|
|
247
|
-
expect(mockEventBus.emitEvent).toHaveBeenCalledWith(
|
|
248
|
-
'order.created',
|
|
249
|
-
expect.objectContaining({
|
|
250
|
-
orderId: 'order-123',
|
|
251
|
-
status: 'pending',
|
|
252
|
-
_workflow: expect.objectContaining({
|
|
253
|
-
workflowInstanceId: testInstanceId,
|
|
254
|
-
tenantId: testTenantId,
|
|
255
|
-
}),
|
|
256
|
-
})
|
|
257
|
-
)
|
|
258
|
-
})
|
|
259
|
-
|
|
260
|
-
test('should fail EMIT_EVENT if event bus not available', async () => {
|
|
261
|
-
mockContainer.resolve.mockImplementation(() => {
|
|
262
|
-
throw new Error('eventBus not registered')
|
|
263
|
-
})
|
|
264
|
-
|
|
265
|
-
const activity: ActivityDefinition = {
|
|
266
|
-
activityId: 'activity-6',
|
|
267
|
-
activityName: 'Test Event',
|
|
268
|
-
activityType: 'EMIT_EVENT',
|
|
269
|
-
config: {
|
|
270
|
-
eventName: 'test.event',
|
|
271
|
-
payload: {},
|
|
272
|
-
},
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
const result = await activityExecutor.executeActivity(
|
|
276
|
-
mockEm,
|
|
277
|
-
mockContainer,
|
|
278
|
-
activity,
|
|
279
|
-
mockContext
|
|
280
|
-
)
|
|
281
|
-
|
|
282
|
-
expect(result.success).toBe(false)
|
|
283
|
-
expect(result.error).toContain('eventBus not registered')
|
|
284
|
-
})
|
|
285
|
-
|
|
286
|
-
test('should fail EMIT_EVENT if missing eventName', async () => {
|
|
287
|
-
const mockEventBus = {
|
|
288
|
-
emitEvent: jest.fn().mockResolvedValue(undefined),
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
mockContainer.resolve.mockReturnValue(mockEventBus)
|
|
292
|
-
|
|
293
|
-
const activity: ActivityDefinition = {
|
|
294
|
-
activityId: 'activity-7',
|
|
295
|
-
activityName: 'Invalid Event',
|
|
296
|
-
activityType: 'EMIT_EVENT',
|
|
297
|
-
config: {
|
|
298
|
-
// Missing eventName
|
|
299
|
-
payload: {},
|
|
300
|
-
},
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
const result = await activityExecutor.executeActivity(
|
|
304
|
-
mockEm,
|
|
305
|
-
mockContainer,
|
|
306
|
-
activity,
|
|
307
|
-
mockContext
|
|
308
|
-
)
|
|
309
|
-
|
|
310
|
-
expect(result.success).toBe(false)
|
|
311
|
-
expect(result.error).toContain('requires "eventName"')
|
|
312
|
-
})
|
|
313
|
-
})
|
|
314
|
-
|
|
315
|
-
// ============================================================================
|
|
316
|
-
// UPDATE_ENTITY Activity Tests
|
|
317
|
-
// ============================================================================
|
|
318
|
-
|
|
319
|
-
describe('UPDATE_ENTITY activity', () => {
|
|
320
|
-
test('should execute UPDATE_ENTITY activity successfully', async () => {
|
|
321
|
-
const mockCommandBus = {
|
|
322
|
-
execute: jest.fn().mockResolvedValue({
|
|
323
|
-
result: { id: 'order-123', status: 'confirmed' },
|
|
324
|
-
logEntry: { id: 'log-123' },
|
|
325
|
-
}),
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
mockContainer.resolve.mockReturnValue(mockCommandBus)
|
|
329
|
-
|
|
330
|
-
const activity: ActivityDefinition = {
|
|
331
|
-
activityId: 'activity-8',
|
|
332
|
-
activityName: 'Update Order Status',
|
|
333
|
-
activityType: 'UPDATE_ENTITY',
|
|
334
|
-
config: {
|
|
335
|
-
commandId: 'sales.orders.update',
|
|
336
|
-
input: {
|
|
337
|
-
id: 'order-123',
|
|
338
|
-
statusEntryId: 'status-confirmed-id',
|
|
339
|
-
},
|
|
340
|
-
},
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
const result = await activityExecutor.executeActivity(
|
|
344
|
-
mockEm,
|
|
345
|
-
mockContainer,
|
|
346
|
-
activity,
|
|
347
|
-
mockContext
|
|
348
|
-
)
|
|
349
|
-
|
|
350
|
-
expect(result.success).toBe(true)
|
|
351
|
-
expect(result.output.executed).toBe(true)
|
|
352
|
-
expect(result.output.commandId).toBe('sales.orders.update')
|
|
353
|
-
expect(mockCommandBus.execute).toHaveBeenCalledWith(
|
|
354
|
-
'sales.orders.update',
|
|
355
|
-
expect.objectContaining({
|
|
356
|
-
input: expect.objectContaining({
|
|
357
|
-
id: 'order-123',
|
|
358
|
-
statusEntryId: 'status-confirmed-id',
|
|
359
|
-
}),
|
|
360
|
-
})
|
|
361
|
-
)
|
|
362
|
-
})
|
|
363
|
-
|
|
364
|
-
test('should fail UPDATE_ENTITY if command bus not available', async () => {
|
|
365
|
-
mockContainer.resolve.mockImplementation(() => {
|
|
366
|
-
throw new Error('commandBus not registered')
|
|
367
|
-
})
|
|
368
|
-
|
|
369
|
-
const activity: ActivityDefinition = {
|
|
370
|
-
activityId: 'activity-9',
|
|
371
|
-
activityName: 'Test Update',
|
|
372
|
-
activityType: 'UPDATE_ENTITY',
|
|
373
|
-
config: {
|
|
374
|
-
commandId: 'sales.orders.update',
|
|
375
|
-
input: { id: 'order-123', status: 'confirmed' },
|
|
376
|
-
},
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
const result = await activityExecutor.executeActivity(
|
|
380
|
-
mockEm,
|
|
381
|
-
mockContainer,
|
|
382
|
-
activity,
|
|
383
|
-
mockContext
|
|
384
|
-
)
|
|
385
|
-
|
|
386
|
-
expect(result.success).toBe(false)
|
|
387
|
-
expect(result.error).toContain('commandBus not registered')
|
|
388
|
-
})
|
|
389
|
-
|
|
390
|
-
test('should fail UPDATE_ENTITY if missing required fields', async () => {
|
|
391
|
-
const mockCommandBus = {
|
|
392
|
-
execute: jest.fn().mockResolvedValue({ result: {} }),
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
mockContainer.resolve.mockReturnValue(mockCommandBus)
|
|
396
|
-
|
|
397
|
-
const activity: ActivityDefinition = {
|
|
398
|
-
activityId: 'activity-10',
|
|
399
|
-
activityName: 'Invalid Update',
|
|
400
|
-
activityType: 'UPDATE_ENTITY',
|
|
401
|
-
config: {
|
|
402
|
-
// Missing commandId
|
|
403
|
-
input: { id: 'order-123' },
|
|
404
|
-
},
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
const result = await activityExecutor.executeActivity(
|
|
408
|
-
mockEm,
|
|
409
|
-
mockContainer,
|
|
410
|
-
activity,
|
|
411
|
-
mockContext
|
|
412
|
-
)
|
|
413
|
-
|
|
414
|
-
expect(result.success).toBe(false)
|
|
415
|
-
expect(result.error).toContain('requires "commandId"')
|
|
416
|
-
})
|
|
417
|
-
})
|
|
418
|
-
|
|
419
|
-
// ============================================================================
|
|
420
|
-
// CALL_WEBHOOK Activity Tests
|
|
421
|
-
// ============================================================================
|
|
422
|
-
|
|
423
|
-
describe('CALL_WEBHOOK activity', () => {
|
|
424
|
-
test('should execute CALL_WEBHOOK activity successfully', async () => {
|
|
425
|
-
;(global.fetch as jest.Mock).mockResolvedValue({
|
|
426
|
-
ok: true,
|
|
427
|
-
status: 200,
|
|
428
|
-
statusText: 'OK',
|
|
429
|
-
headers: new Headers({ 'content-type': 'application/json' }),
|
|
430
|
-
json: async () => ({ success: true, orderId: 'order-123' }),
|
|
431
|
-
})
|
|
432
|
-
|
|
433
|
-
const activity: ActivityDefinition = {
|
|
434
|
-
activityId: 'activity-11',
|
|
435
|
-
activityName: 'Notify External System',
|
|
436
|
-
activityType: 'CALL_WEBHOOK',
|
|
437
|
-
config: {
|
|
438
|
-
url: 'https://example.com/webhook',
|
|
439
|
-
method: 'POST',
|
|
440
|
-
body: {
|
|
441
|
-
event: 'order.created',
|
|
442
|
-
orderId: 'order-123',
|
|
443
|
-
},
|
|
444
|
-
},
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
const result = await activityExecutor.executeActivity(
|
|
448
|
-
mockEm,
|
|
449
|
-
mockContainer,
|
|
450
|
-
activity,
|
|
451
|
-
mockContext
|
|
452
|
-
)
|
|
453
|
-
|
|
454
|
-
expect(result.success).toBe(true)
|
|
455
|
-
expect(result.output.status).toBe(200)
|
|
456
|
-
expect(result.output.result).toEqual({ success: true, orderId: 'order-123' })
|
|
457
|
-
expect(global.fetch).toHaveBeenCalledWith(
|
|
458
|
-
'https://example.com/webhook',
|
|
459
|
-
expect.objectContaining({
|
|
460
|
-
method: 'POST',
|
|
461
|
-
headers: expect.objectContaining({
|
|
462
|
-
'Content-Type': 'application/json',
|
|
463
|
-
}),
|
|
464
|
-
body: expect.any(String),
|
|
465
|
-
})
|
|
466
|
-
)
|
|
467
|
-
})
|
|
468
|
-
|
|
469
|
-
test('should handle non-JSON webhook responses', async () => {
|
|
470
|
-
;(global.fetch as jest.Mock).mockResolvedValue({
|
|
471
|
-
ok: true,
|
|
472
|
-
status: 200,
|
|
473
|
-
statusText: 'OK',
|
|
474
|
-
headers: new Headers({ 'content-type': 'text/plain' }),
|
|
475
|
-
text: async () => 'Success',
|
|
476
|
-
})
|
|
477
|
-
|
|
478
|
-
const activity: ActivityDefinition = {
|
|
479
|
-
activityId: 'activity-12',
|
|
480
|
-
activityName: 'Call Text Webhook',
|
|
481
|
-
activityType: 'CALL_WEBHOOK',
|
|
482
|
-
config: {
|
|
483
|
-
url: 'https://example.com/webhook',
|
|
484
|
-
},
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
const result = await activityExecutor.executeActivity(
|
|
488
|
-
mockEm,
|
|
489
|
-
mockContainer,
|
|
490
|
-
activity,
|
|
491
|
-
mockContext
|
|
492
|
-
)
|
|
493
|
-
|
|
494
|
-
expect(result.success).toBe(true)
|
|
495
|
-
expect(result.output.result).toBe('Success')
|
|
496
|
-
})
|
|
497
|
-
|
|
498
|
-
test('should fail CALL_WEBHOOK on HTTP error', async () => {
|
|
499
|
-
;(global.fetch as jest.Mock).mockResolvedValue({
|
|
500
|
-
ok: false,
|
|
501
|
-
status: 404,
|
|
502
|
-
statusText: 'Not Found',
|
|
503
|
-
headers: new Headers({ 'content-type': 'application/json' }),
|
|
504
|
-
json: async () => ({ error: 'Not found' }),
|
|
505
|
-
})
|
|
506
|
-
|
|
507
|
-
const activity: ActivityDefinition = {
|
|
508
|
-
activityId: 'activity-13',
|
|
509
|
-
activityName: 'Failed Webhook',
|
|
510
|
-
activityType: 'CALL_WEBHOOK',
|
|
511
|
-
config: {
|
|
512
|
-
url: 'https://example.com/not-found',
|
|
513
|
-
},
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
const result = await activityExecutor.executeActivity(
|
|
517
|
-
mockEm,
|
|
518
|
-
mockContainer,
|
|
519
|
-
activity,
|
|
520
|
-
mockContext
|
|
521
|
-
)
|
|
522
|
-
|
|
523
|
-
expect(result.success).toBe(false)
|
|
524
|
-
expect(result.error).toContain('failed with status 404')
|
|
525
|
-
})
|
|
526
|
-
|
|
527
|
-
test('should fail CALL_WEBHOOK if missing url', async () => {
|
|
528
|
-
const activity: ActivityDefinition = {
|
|
529
|
-
activityId: 'activity-14',
|
|
530
|
-
activityName: 'Invalid Webhook',
|
|
531
|
-
activityType: 'CALL_WEBHOOK',
|
|
532
|
-
config: {
|
|
533
|
-
// Missing url
|
|
534
|
-
body: {},
|
|
535
|
-
},
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
const result = await activityExecutor.executeActivity(
|
|
539
|
-
mockEm,
|
|
540
|
-
mockContainer,
|
|
541
|
-
activity,
|
|
542
|
-
mockContext
|
|
543
|
-
)
|
|
544
|
-
|
|
545
|
-
expect(result.success).toBe(false)
|
|
546
|
-
expect(result.error).toContain('requires "url"')
|
|
547
|
-
})
|
|
548
|
-
})
|
|
549
|
-
|
|
550
|
-
// ============================================================================
|
|
551
|
-
// EXECUTE_FUNCTION Activity Tests
|
|
552
|
-
// ============================================================================
|
|
553
|
-
|
|
554
|
-
describe('EXECUTE_FUNCTION activity', () => {
|
|
555
|
-
test('should execute EXECUTE_FUNCTION activity successfully', async () => {
|
|
556
|
-
const mockFunction = jest.fn().mockResolvedValue({
|
|
557
|
-
calculated: true,
|
|
558
|
-
total: 150.5,
|
|
559
|
-
})
|
|
560
|
-
|
|
561
|
-
mockContainer.resolve.mockReturnValue(mockFunction)
|
|
562
|
-
|
|
563
|
-
const activity: ActivityDefinition = {
|
|
564
|
-
activityId: 'activity-15',
|
|
565
|
-
activityName: 'Calculate Total',
|
|
566
|
-
activityType: 'EXECUTE_FUNCTION',
|
|
567
|
-
config: {
|
|
568
|
-
functionName: 'calculateOrderTotal',
|
|
569
|
-
args: {
|
|
570
|
-
orderId: 'order-123',
|
|
571
|
-
includeShipping: true,
|
|
572
|
-
},
|
|
573
|
-
},
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
const result = await activityExecutor.executeActivity(
|
|
577
|
-
mockEm,
|
|
578
|
-
mockContainer,
|
|
579
|
-
activity,
|
|
580
|
-
mockContext
|
|
581
|
-
)
|
|
582
|
-
|
|
583
|
-
expect(result.success).toBe(true)
|
|
584
|
-
expect(result.output.executed).toBe(true)
|
|
585
|
-
expect(result.output.result).toEqual({ calculated: true, total: 150.5 })
|
|
586
|
-
expect(mockContainer.resolve).toHaveBeenCalledWith('workflowFunction:calculateOrderTotal')
|
|
587
|
-
expect(mockFunction).toHaveBeenCalledWith(
|
|
588
|
-
{ orderId: 'order-123', includeShipping: true },
|
|
589
|
-
mockContext
|
|
590
|
-
)
|
|
591
|
-
})
|
|
592
|
-
|
|
593
|
-
test('should fail EXECUTE_FUNCTION if function not registered', async () => {
|
|
594
|
-
mockContainer.resolve.mockImplementation(() => {
|
|
595
|
-
throw new Error('workflowFunction:nonExistent not registered')
|
|
596
|
-
})
|
|
597
|
-
|
|
598
|
-
const activity: ActivityDefinition = {
|
|
599
|
-
activityId: 'activity-16',
|
|
600
|
-
activityName: 'Call Missing Function',
|
|
601
|
-
activityType: 'EXECUTE_FUNCTION',
|
|
602
|
-
config: {
|
|
603
|
-
functionName: 'nonExistent',
|
|
604
|
-
args: {},
|
|
605
|
-
},
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
const result = await activityExecutor.executeActivity(
|
|
609
|
-
mockEm,
|
|
610
|
-
mockContainer,
|
|
611
|
-
activity,
|
|
612
|
-
mockContext
|
|
613
|
-
)
|
|
614
|
-
|
|
615
|
-
expect(result.success).toBe(false)
|
|
616
|
-
expect(result.error).toContain('not registered in DI container')
|
|
617
|
-
})
|
|
618
|
-
|
|
619
|
-
test('should fail EXECUTE_FUNCTION if missing functionName', async () => {
|
|
620
|
-
const activity: ActivityDefinition = {
|
|
621
|
-
activityId: 'activity-17',
|
|
622
|
-
activityName: 'Invalid Function',
|
|
623
|
-
activityType: 'EXECUTE_FUNCTION',
|
|
624
|
-
config: {
|
|
625
|
-
// Missing functionName
|
|
626
|
-
args: {},
|
|
627
|
-
},
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
const result = await activityExecutor.executeActivity(
|
|
631
|
-
mockEm,
|
|
632
|
-
mockContainer,
|
|
633
|
-
activity,
|
|
634
|
-
mockContext
|
|
635
|
-
)
|
|
636
|
-
|
|
637
|
-
expect(result.success).toBe(false)
|
|
638
|
-
expect(result.error).toContain('requires "functionName"')
|
|
639
|
-
})
|
|
640
|
-
})
|
|
641
|
-
|
|
642
|
-
// ============================================================================
|
|
643
|
-
// Retry Logic Tests
|
|
644
|
-
// ============================================================================
|
|
645
|
-
|
|
646
|
-
describe('Retry logic', () => {
|
|
647
|
-
test('should retry failed activity with exponential backoff', async () => {
|
|
648
|
-
let attempt = 0
|
|
649
|
-
const mockFunction = jest.fn().mockImplementation(() => {
|
|
650
|
-
attempt++
|
|
651
|
-
if (attempt < 3) {
|
|
652
|
-
throw new Error('Temporary failure')
|
|
653
|
-
}
|
|
654
|
-
return { success: true }
|
|
655
|
-
})
|
|
656
|
-
|
|
657
|
-
mockContainer.resolve.mockReturnValue(mockFunction)
|
|
658
|
-
|
|
659
|
-
const activity: ActivityDefinition = {
|
|
660
|
-
activityId: 'activity-18',
|
|
661
|
-
activityName: 'Flaky Function',
|
|
662
|
-
activityType: 'EXECUTE_FUNCTION',
|
|
663
|
-
config: {
|
|
664
|
-
functionName: 'flakyFunction',
|
|
665
|
-
args: {},
|
|
666
|
-
},
|
|
667
|
-
retryPolicy: {
|
|
668
|
-
maxAttempts: 3,
|
|
669
|
-
initialIntervalMs: 10,
|
|
670
|
-
backoffCoefficient: 2,
|
|
671
|
-
maxIntervalMs: 1000,
|
|
672
|
-
},
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
const result = await activityExecutor.executeActivity(
|
|
676
|
-
mockEm,
|
|
677
|
-
mockContainer,
|
|
678
|
-
activity,
|
|
679
|
-
mockContext
|
|
680
|
-
)
|
|
681
|
-
|
|
682
|
-
expect(result.success).toBe(true)
|
|
683
|
-
expect(result.retryCount).toBe(2) // 0-indexed, so 2 means 3rd attempt
|
|
684
|
-
expect(mockFunction).toHaveBeenCalledTimes(3)
|
|
685
|
-
})
|
|
686
|
-
|
|
687
|
-
test('should fail after exhausting all retry attempts', async () => {
|
|
688
|
-
const mockFunction = jest.fn().mockRejectedValue(new Error('Persistent failure'))
|
|
689
|
-
|
|
690
|
-
mockContainer.resolve.mockReturnValue(mockFunction)
|
|
691
|
-
|
|
692
|
-
const activity: ActivityDefinition = {
|
|
693
|
-
activityId: 'activity-19',
|
|
694
|
-
activityName: 'Always Fails',
|
|
695
|
-
activityType: 'EXECUTE_FUNCTION',
|
|
696
|
-
config: {
|
|
697
|
-
functionName: 'alwaysFails',
|
|
698
|
-
args: {},
|
|
699
|
-
},
|
|
700
|
-
retryPolicy: {
|
|
701
|
-
maxAttempts: 3,
|
|
702
|
-
initialIntervalMs: 5,
|
|
703
|
-
backoffCoefficient: 2,
|
|
704
|
-
maxIntervalMs: 1000,
|
|
705
|
-
},
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
const result = await activityExecutor.executeActivity(
|
|
709
|
-
mockEm,
|
|
710
|
-
mockContainer,
|
|
711
|
-
activity,
|
|
712
|
-
mockContext
|
|
713
|
-
)
|
|
714
|
-
|
|
715
|
-
expect(result.success).toBe(false)
|
|
716
|
-
expect(result.retryCount).toBe(3)
|
|
717
|
-
expect(result.error).toContain('failed after 3 attempts')
|
|
718
|
-
expect(mockFunction).toHaveBeenCalledTimes(3)
|
|
719
|
-
})
|
|
720
|
-
|
|
721
|
-
test('should not retry if maxAttempts is 1', async () => {
|
|
722
|
-
const mockFunction = jest.fn().mockRejectedValue(new Error('Immediate failure'))
|
|
723
|
-
|
|
724
|
-
mockContainer.resolve.mockReturnValue(mockFunction)
|
|
725
|
-
|
|
726
|
-
const activity: ActivityDefinition = {
|
|
727
|
-
activityId: 'activity-20',
|
|
728
|
-
activityName: 'No Retry',
|
|
729
|
-
activityType: 'EXECUTE_FUNCTION',
|
|
730
|
-
config: {
|
|
731
|
-
functionName: 'noRetry',
|
|
732
|
-
args: {},
|
|
733
|
-
},
|
|
734
|
-
retryPolicy: {
|
|
735
|
-
maxAttempts: 1,
|
|
736
|
-
initialIntervalMs: 0,
|
|
737
|
-
backoffCoefficient: 1,
|
|
738
|
-
maxIntervalMs: 0,
|
|
739
|
-
},
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
const result = await activityExecutor.executeActivity(
|
|
743
|
-
mockEm,
|
|
744
|
-
mockContainer,
|
|
745
|
-
activity,
|
|
746
|
-
mockContext
|
|
747
|
-
)
|
|
748
|
-
|
|
749
|
-
expect(result.success).toBe(false)
|
|
750
|
-
expect(result.retryCount).toBe(1)
|
|
751
|
-
expect(mockFunction).toHaveBeenCalledTimes(1)
|
|
752
|
-
})
|
|
753
|
-
})
|
|
754
|
-
|
|
755
|
-
// ============================================================================
|
|
756
|
-
// Timeout Tests
|
|
757
|
-
// ============================================================================
|
|
758
|
-
|
|
759
|
-
describe('Timeout handling', () => {
|
|
760
|
-
test('should timeout if activity takes too long', async () => {
|
|
761
|
-
const mockFunction = jest.fn().mockImplementation(async () => {
|
|
762
|
-
await new Promise((resolve) => setTimeout(resolve, 200))
|
|
763
|
-
return { success: true }
|
|
764
|
-
})
|
|
765
|
-
|
|
766
|
-
mockContainer.resolve.mockReturnValue(mockFunction)
|
|
767
|
-
|
|
768
|
-
const activity: ActivityDefinition = {
|
|
769
|
-
activityId: 'activity-21',
|
|
770
|
-
activityName: 'Slow Function',
|
|
771
|
-
activityType: 'EXECUTE_FUNCTION',
|
|
772
|
-
config: {
|
|
773
|
-
functionName: 'slowFunction',
|
|
774
|
-
args: {},
|
|
775
|
-
},
|
|
776
|
-
timeoutMs: 50, // Very short timeout
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
const result = await activityExecutor.executeActivity(
|
|
780
|
-
mockEm,
|
|
781
|
-
mockContainer,
|
|
782
|
-
activity,
|
|
783
|
-
mockContext
|
|
784
|
-
)
|
|
785
|
-
|
|
786
|
-
expect(result.success).toBe(false)
|
|
787
|
-
expect(result.error).toContain('timeout after 50ms')
|
|
788
|
-
})
|
|
789
|
-
})
|
|
790
|
-
|
|
791
|
-
// ============================================================================
|
|
792
|
-
// Variable Interpolation Type Preservation Tests
|
|
793
|
-
// ============================================================================
|
|
794
|
-
|
|
795
|
-
describe('Variable interpolation type preservation', () => {
|
|
796
|
-
test('should preserve array type for single variable interpolation', async () => {
|
|
797
|
-
const mockFunction = jest.fn().mockImplementation((args) => {
|
|
798
|
-
// Verify that the array is passed as-is, not converted to string
|
|
799
|
-
expect(Array.isArray(args.items)).toBe(true)
|
|
800
|
-
expect(args.items).toHaveLength(2)
|
|
801
|
-
expect(args.items[0]).toEqual({ id: 1, name: 'Item 1' })
|
|
802
|
-
return { success: true }
|
|
803
|
-
})
|
|
804
|
-
|
|
805
|
-
mockContainer.resolve.mockReturnValue(mockFunction)
|
|
806
|
-
|
|
807
|
-
const mockContextWithArray = {
|
|
808
|
-
...mockContext,
|
|
809
|
-
workflowContext: {
|
|
810
|
-
...mockContext.workflowContext,
|
|
811
|
-
itemsList: [
|
|
812
|
-
{ id: 1, name: 'Item 1' },
|
|
813
|
-
{ id: 2, name: 'Item 2' },
|
|
814
|
-
],
|
|
815
|
-
},
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
const activity: ActivityDefinition = {
|
|
819
|
-
activityId: 'activity-22',
|
|
820
|
-
activityName: 'Test Array Preservation',
|
|
821
|
-
activityType: 'EXECUTE_FUNCTION',
|
|
822
|
-
config: {
|
|
823
|
-
functionName: 'testFunction',
|
|
824
|
-
args: {
|
|
825
|
-
items: '{{itemsList}}', // Single variable - should preserve array type
|
|
826
|
-
},
|
|
827
|
-
},
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
const result = await activityExecutor.executeActivity(
|
|
831
|
-
mockEm,
|
|
832
|
-
mockContainer,
|
|
833
|
-
activity,
|
|
834
|
-
mockContextWithArray
|
|
835
|
-
)
|
|
836
|
-
|
|
837
|
-
expect(result.success).toBe(true)
|
|
838
|
-
expect(mockFunction).toHaveBeenCalled()
|
|
839
|
-
})
|
|
840
|
-
|
|
841
|
-
test('should preserve object type for single variable interpolation', async () => {
|
|
842
|
-
const mockFunction = jest.fn().mockImplementation((args) => {
|
|
843
|
-
// Verify that the object is passed as-is, not converted to string
|
|
844
|
-
expect(typeof args.customer).toBe('object')
|
|
845
|
-
expect(args.customer.name).toBe('John Doe')
|
|
846
|
-
expect(args.customer.age).toBe(30)
|
|
847
|
-
return { success: true }
|
|
848
|
-
})
|
|
849
|
-
|
|
850
|
-
mockContainer.resolve.mockReturnValue(mockFunction)
|
|
851
|
-
|
|
852
|
-
const mockContextWithObject = {
|
|
853
|
-
...mockContext,
|
|
854
|
-
workflowContext: {
|
|
855
|
-
...mockContext.workflowContext,
|
|
856
|
-
customerData: { name: 'John Doe', age: 30, email: 'john@example.com' },
|
|
857
|
-
},
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
const activity: ActivityDefinition = {
|
|
861
|
-
activityId: 'activity-23',
|
|
862
|
-
activityName: 'Test Object Preservation',
|
|
863
|
-
activityType: 'EXECUTE_FUNCTION',
|
|
864
|
-
config: {
|
|
865
|
-
functionName: 'testFunction',
|
|
866
|
-
args: {
|
|
867
|
-
customer: '{{customerData}}', // Single variable - should preserve object type
|
|
868
|
-
},
|
|
869
|
-
},
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
const result = await activityExecutor.executeActivity(
|
|
873
|
-
mockEm,
|
|
874
|
-
mockContainer,
|
|
875
|
-
activity,
|
|
876
|
-
mockContextWithObject
|
|
877
|
-
)
|
|
878
|
-
|
|
879
|
-
expect(result.success).toBe(true)
|
|
880
|
-
expect(mockFunction).toHaveBeenCalled()
|
|
881
|
-
})
|
|
882
|
-
|
|
883
|
-
test('should preserve number type for single variable interpolation', async () => {
|
|
884
|
-
const mockFunction = jest.fn().mockImplementation((args) => {
|
|
885
|
-
// Verify that the number is passed as-is, not converted to string
|
|
886
|
-
expect(typeof args.total).toBe('number')
|
|
887
|
-
expect(args.total).toBe(120.5)
|
|
888
|
-
return { success: true }
|
|
889
|
-
})
|
|
890
|
-
|
|
891
|
-
mockContainer.resolve.mockReturnValue(mockFunction)
|
|
892
|
-
|
|
893
|
-
const mockContextWithNumber = {
|
|
894
|
-
...mockContext,
|
|
895
|
-
workflowContext: {
|
|
896
|
-
...mockContext.workflowContext,
|
|
897
|
-
orderTotal: 120.5,
|
|
898
|
-
},
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
const activity: ActivityDefinition = {
|
|
902
|
-
activityId: 'activity-24',
|
|
903
|
-
activityName: 'Test Number Preservation',
|
|
904
|
-
activityType: 'EXECUTE_FUNCTION',
|
|
905
|
-
config: {
|
|
906
|
-
functionName: 'testFunction',
|
|
907
|
-
args: {
|
|
908
|
-
total: '{{orderTotal}}', // Single variable - should preserve number type
|
|
909
|
-
},
|
|
910
|
-
},
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
const result = await activityExecutor.executeActivity(
|
|
914
|
-
mockEm,
|
|
915
|
-
mockContainer,
|
|
916
|
-
activity,
|
|
917
|
-
mockContextWithNumber
|
|
918
|
-
)
|
|
919
|
-
|
|
920
|
-
expect(result.success).toBe(true)
|
|
921
|
-
expect(mockFunction).toHaveBeenCalled()
|
|
922
|
-
})
|
|
923
|
-
|
|
924
|
-
test('should preserve boolean type for single variable interpolation', async () => {
|
|
925
|
-
const mockFunction = jest.fn().mockImplementation((args) => {
|
|
926
|
-
// Verify that the boolean is passed as-is, not converted to string
|
|
927
|
-
expect(typeof args.isActive).toBe('boolean')
|
|
928
|
-
expect(args.isActive).toBe(true)
|
|
929
|
-
return { success: true }
|
|
930
|
-
})
|
|
931
|
-
|
|
932
|
-
mockContainer.resolve.mockReturnValue(mockFunction)
|
|
933
|
-
|
|
934
|
-
const mockContextWithBoolean = {
|
|
935
|
-
...mockContext,
|
|
936
|
-
workflowContext: {
|
|
937
|
-
...mockContext.workflowContext,
|
|
938
|
-
activeStatus: true,
|
|
939
|
-
},
|
|
940
|
-
}
|
|
941
|
-
|
|
942
|
-
const activity: ActivityDefinition = {
|
|
943
|
-
activityId: 'activity-25',
|
|
944
|
-
activityName: 'Test Boolean Preservation',
|
|
945
|
-
activityType: 'EXECUTE_FUNCTION',
|
|
946
|
-
config: {
|
|
947
|
-
functionName: 'testFunction',
|
|
948
|
-
args: {
|
|
949
|
-
isActive: '{{activeStatus}}', // Single variable - should preserve boolean type
|
|
950
|
-
},
|
|
951
|
-
},
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
const result = await activityExecutor.executeActivity(
|
|
955
|
-
mockEm,
|
|
956
|
-
mockContainer,
|
|
957
|
-
activity,
|
|
958
|
-
mockContextWithBoolean
|
|
959
|
-
)
|
|
960
|
-
|
|
961
|
-
expect(result.success).toBe(true)
|
|
962
|
-
expect(mockFunction).toHaveBeenCalled()
|
|
963
|
-
})
|
|
964
|
-
|
|
965
|
-
test('should return string for mixed variable interpolation', async () => {
|
|
966
|
-
const mockFunction = jest.fn().mockImplementation((args) => {
|
|
967
|
-
// Verify that mixed interpolation produces a string
|
|
968
|
-
expect(typeof args.message).toBe('string')
|
|
969
|
-
expect(args.message).toBe('Order order-123 has status confirmed')
|
|
970
|
-
return { success: true }
|
|
971
|
-
})
|
|
972
|
-
|
|
973
|
-
mockContainer.resolve.mockReturnValue(mockFunction)
|
|
974
|
-
|
|
975
|
-
const mockContextWithStatus = {
|
|
976
|
-
...mockContext,
|
|
977
|
-
workflowContext: {
|
|
978
|
-
...mockContext.workflowContext,
|
|
979
|
-
status: 'confirmed',
|
|
980
|
-
},
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
const activity: ActivityDefinition = {
|
|
984
|
-
activityId: 'activity-26',
|
|
985
|
-
activityName: 'Test Mixed Interpolation',
|
|
986
|
-
activityType: 'EXECUTE_FUNCTION',
|
|
987
|
-
config: {
|
|
988
|
-
functionName: 'testFunction',
|
|
989
|
-
args: {
|
|
990
|
-
message: 'Order {{orderId}} has status {{status}}', // Mixed interpolation - should be string
|
|
991
|
-
},
|
|
992
|
-
},
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
const result = await activityExecutor.executeActivity(
|
|
996
|
-
mockEm,
|
|
997
|
-
mockContainer,
|
|
998
|
-
activity,
|
|
999
|
-
mockContextWithStatus
|
|
1000
|
-
)
|
|
1001
|
-
|
|
1002
|
-
expect(result.success).toBe(true)
|
|
1003
|
-
expect(mockFunction).toHaveBeenCalled()
|
|
1004
|
-
})
|
|
1005
|
-
|
|
1006
|
-
test('should handle nested objects with mixed type interpolations', async () => {
|
|
1007
|
-
const mockFunction = jest.fn().mockImplementation((args) => {
|
|
1008
|
-
// Verify nested structure with mixed types
|
|
1009
|
-
expect(Array.isArray(args.data.items)).toBe(true)
|
|
1010
|
-
expect(args.data.items).toHaveLength(2)
|
|
1011
|
-
expect(typeof args.data.message).toBe('string')
|
|
1012
|
-
expect(args.data.message).toBe('Found 5 items')
|
|
1013
|
-
expect(args.data.description).toBe('Test')
|
|
1014
|
-
return { success: true }
|
|
1015
|
-
})
|
|
1016
|
-
|
|
1017
|
-
mockContainer.resolve.mockReturnValue(mockFunction)
|
|
1018
|
-
|
|
1019
|
-
const mockContextWithMixed = {
|
|
1020
|
-
...mockContext,
|
|
1021
|
-
workflowContext: {
|
|
1022
|
-
...mockContext.workflowContext,
|
|
1023
|
-
lineItems: [{ id: 1 }, { id: 2 }],
|
|
1024
|
-
itemCount: 5,
|
|
1025
|
-
note: 'Test',
|
|
1026
|
-
},
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
const activity: ActivityDefinition = {
|
|
1030
|
-
activityId: 'activity-27',
|
|
1031
|
-
activityName: 'Test Nested Mixed Interpolation',
|
|
1032
|
-
activityType: 'EXECUTE_FUNCTION',
|
|
1033
|
-
config: {
|
|
1034
|
-
functionName: 'testFunction',
|
|
1035
|
-
args: {
|
|
1036
|
-
data: {
|
|
1037
|
-
items: '{{lineItems}}', // Single var - preserves array
|
|
1038
|
-
message: 'Found {{itemCount}} items', // Mixed - becomes string
|
|
1039
|
-
description: '{{note}}', // Single var - preserves type (string)
|
|
1040
|
-
},
|
|
1041
|
-
},
|
|
1042
|
-
},
|
|
1043
|
-
}
|
|
1044
|
-
|
|
1045
|
-
const result = await activityExecutor.executeActivity(
|
|
1046
|
-
mockEm,
|
|
1047
|
-
mockContainer,
|
|
1048
|
-
activity,
|
|
1049
|
-
mockContextWithMixed
|
|
1050
|
-
)
|
|
1051
|
-
|
|
1052
|
-
expect(result.success).toBe(true)
|
|
1053
|
-
expect(mockFunction).toHaveBeenCalled()
|
|
1054
|
-
})
|
|
1055
|
-
|
|
1056
|
-
test('should preserve workflow.version as number for single variable', async () => {
|
|
1057
|
-
const mockFunction = jest.fn().mockImplementation((args) => {
|
|
1058
|
-
// Verify that workflow.version is a number, not a string
|
|
1059
|
-
expect(typeof args.version).toBe('number')
|
|
1060
|
-
expect(args.version).toBe(1)
|
|
1061
|
-
return { success: true }
|
|
1062
|
-
})
|
|
1063
|
-
|
|
1064
|
-
mockContainer.resolve.mockReturnValue(mockFunction)
|
|
1065
|
-
|
|
1066
|
-
const activity: ActivityDefinition = {
|
|
1067
|
-
activityId: 'activity-28',
|
|
1068
|
-
activityName: 'Test Workflow Version Type',
|
|
1069
|
-
activityType: 'EXECUTE_FUNCTION',
|
|
1070
|
-
config: {
|
|
1071
|
-
functionName: 'testFunction',
|
|
1072
|
-
args: {
|
|
1073
|
-
version: '{{workflow.version}}', // Single variable - should preserve number type
|
|
1074
|
-
},
|
|
1075
|
-
},
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
const result = await activityExecutor.executeActivity(
|
|
1079
|
-
mockEm,
|
|
1080
|
-
mockContainer,
|
|
1081
|
-
activity,
|
|
1082
|
-
mockContext
|
|
1083
|
-
)
|
|
1084
|
-
|
|
1085
|
-
expect(result.success).toBe(true)
|
|
1086
|
-
expect(mockFunction).toHaveBeenCalled()
|
|
1087
|
-
})
|
|
1088
|
-
})
|
|
1089
|
-
|
|
1090
|
-
// ============================================================================
|
|
1091
|
-
// Multiple Activities Tests
|
|
1092
|
-
// ============================================================================
|
|
1093
|
-
|
|
1094
|
-
describe('executeActivities', () => {
|
|
1095
|
-
test('should execute multiple activities in sequence', async () => {
|
|
1096
|
-
const mockEventBus = {
|
|
1097
|
-
emitEvent: jest.fn().mockResolvedValue(undefined),
|
|
1098
|
-
}
|
|
1099
|
-
|
|
1100
|
-
const mockCommandBus = {
|
|
1101
|
-
execute: jest.fn().mockResolvedValue({
|
|
1102
|
-
result: { id: 'order-123', status: 'confirmed' },
|
|
1103
|
-
logEntry: { id: 'log-123' },
|
|
1104
|
-
}),
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
|
-
mockContainer.resolve
|
|
1108
|
-
.mockReturnValueOnce(mockEventBus) // First activity
|
|
1109
|
-
.mockReturnValueOnce(mockCommandBus) // Second activity
|
|
1110
|
-
|
|
1111
|
-
const activities: ActivityDefinition[] = [
|
|
1112
|
-
{
|
|
1113
|
-
activityId: 'activity-29',
|
|
1114
|
-
activityName: 'Emit Event',
|
|
1115
|
-
activityType: 'EMIT_EVENT',
|
|
1116
|
-
config: {
|
|
1117
|
-
eventName: 'test.event',
|
|
1118
|
-
payload: { test: true },
|
|
1119
|
-
},
|
|
1120
|
-
},
|
|
1121
|
-
{
|
|
1122
|
-
activityId: 'activity-30',
|
|
1123
|
-
activityName: 'Update Entity',
|
|
1124
|
-
activityType: 'UPDATE_ENTITY',
|
|
1125
|
-
config: {
|
|
1126
|
-
commandId: 'sales.orders.update',
|
|
1127
|
-
input: {
|
|
1128
|
-
id: 'order-123',
|
|
1129
|
-
statusEntryId: 'status-confirmed-id',
|
|
1130
|
-
},
|
|
1131
|
-
},
|
|
1132
|
-
},
|
|
1133
|
-
]
|
|
1134
|
-
|
|
1135
|
-
const results = await activityExecutor.executeActivities(
|
|
1136
|
-
mockEm,
|
|
1137
|
-
mockContainer,
|
|
1138
|
-
activities,
|
|
1139
|
-
mockContext
|
|
1140
|
-
)
|
|
1141
|
-
|
|
1142
|
-
expect(results).toHaveLength(2)
|
|
1143
|
-
expect(results[0].success).toBe(true)
|
|
1144
|
-
expect(results[0].activityType).toBe('EMIT_EVENT')
|
|
1145
|
-
expect(results[1].success).toBe(true)
|
|
1146
|
-
expect(results[1].activityType).toBe('UPDATE_ENTITY')
|
|
1147
|
-
})
|
|
1148
|
-
|
|
1149
|
-
test('should stop execution if activity fails (fail-fast)', async () => {
|
|
1150
|
-
const mockEventBus = {
|
|
1151
|
-
emitEvent: jest.fn().mockRejectedValue(new Error('Event bus error')),
|
|
1152
|
-
}
|
|
1153
|
-
|
|
1154
|
-
const mockQueryEngine = {
|
|
1155
|
-
update: jest.fn().mockResolvedValue({ updated: 1 }),
|
|
1156
|
-
}
|
|
1157
|
-
|
|
1158
|
-
mockContainer.resolve
|
|
1159
|
-
.mockReturnValueOnce(mockEventBus) // First activity (fails)
|
|
1160
|
-
.mockReturnValueOnce(mockQueryEngine) // Second activity (should not execute)
|
|
1161
|
-
|
|
1162
|
-
const activities: ActivityDefinition[] = [
|
|
1163
|
-
{
|
|
1164
|
-
activityId: 'activity-31',
|
|
1165
|
-
activityName: 'Emit Event',
|
|
1166
|
-
activityType: 'EMIT_EVENT',
|
|
1167
|
-
config: {
|
|
1168
|
-
eventName: 'test.event',
|
|
1169
|
-
payload: {},
|
|
1170
|
-
},
|
|
1171
|
-
},
|
|
1172
|
-
{
|
|
1173
|
-
activityId: 'activity-32',
|
|
1174
|
-
activityName: 'Update Entity',
|
|
1175
|
-
activityType: 'UPDATE_ENTITY',
|
|
1176
|
-
config: {
|
|
1177
|
-
entityType: 'orders',
|
|
1178
|
-
entityId: 'order-123',
|
|
1179
|
-
updates: { status: 'confirmed' },
|
|
1180
|
-
},
|
|
1181
|
-
},
|
|
1182
|
-
]
|
|
1183
|
-
|
|
1184
|
-
const results = await activityExecutor.executeActivities(
|
|
1185
|
-
mockEm,
|
|
1186
|
-
mockContainer,
|
|
1187
|
-
activities,
|
|
1188
|
-
mockContext
|
|
1189
|
-
)
|
|
1190
|
-
|
|
1191
|
-
// Only first activity executed (and failed)
|
|
1192
|
-
expect(results).toHaveLength(1)
|
|
1193
|
-
expect(results[0].success).toBe(false)
|
|
1194
|
-
expect(mockQueryEngine.update).not.toHaveBeenCalled()
|
|
1195
|
-
})
|
|
1196
|
-
|
|
1197
|
-
test('should update workflow context with activity outputs', async () => {
|
|
1198
|
-
const mockFunction = jest.fn().mockResolvedValue({ calculated: 100 })
|
|
1199
|
-
|
|
1200
|
-
mockContainer.resolve.mockReturnValue(mockFunction)
|
|
1201
|
-
|
|
1202
|
-
const activities: ActivityDefinition[] = [
|
|
1203
|
-
{
|
|
1204
|
-
activityId: 'activity-33',
|
|
1205
|
-
activityName: 'Calculate',
|
|
1206
|
-
activityType: 'EXECUTE_FUNCTION',
|
|
1207
|
-
config: {
|
|
1208
|
-
functionName: 'calculate',
|
|
1209
|
-
args: {},
|
|
1210
|
-
},
|
|
1211
|
-
},
|
|
1212
|
-
{
|
|
1213
|
-
activityId: 'activity-34',
|
|
1214
|
-
activityName: 'Calculate Again',
|
|
1215
|
-
activityType: 'EXECUTE_FUNCTION',
|
|
1216
|
-
config: {
|
|
1217
|
-
functionName: 'calculate',
|
|
1218
|
-
args: {},
|
|
1219
|
-
},
|
|
1220
|
-
},
|
|
1221
|
-
]
|
|
1222
|
-
|
|
1223
|
-
await activityExecutor.executeActivities(mockEm, mockContainer, activities, mockContext)
|
|
1224
|
-
|
|
1225
|
-
// Context should have outputs from both activities (keyed by activityName)
|
|
1226
|
-
expect(mockContext.workflowContext['Calculate']).toBeDefined()
|
|
1227
|
-
expect(mockContext.workflowContext['Calculate Again']).toBeDefined()
|
|
1228
|
-
})
|
|
1229
|
-
})
|
|
1230
|
-
})
|