@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,592 +0,0 @@
|
|
|
1
|
-
import { describe, test, expect } from '@jest/globals'
|
|
2
|
-
import {
|
|
3
|
-
evaluateExpression,
|
|
4
|
-
type SimpleCondition,
|
|
5
|
-
type GroupCondition,
|
|
6
|
-
type EvaluationContext,
|
|
7
|
-
} from '../expression-evaluator'
|
|
8
|
-
|
|
9
|
-
describe('RuleExpressionEvaluator', () => {
|
|
10
|
-
|
|
11
|
-
describe('Simple Conditions - Equality Operators', () => {
|
|
12
|
-
test('should evaluate = operator (equal)', () => {
|
|
13
|
-
const condition: SimpleCondition = {
|
|
14
|
-
field: 'status',
|
|
15
|
-
operator: '=',
|
|
16
|
-
value: 'ACTIVE',
|
|
17
|
-
}
|
|
18
|
-
expect(evaluateExpression(condition, { status: 'ACTIVE' }, {})).toBe(true)
|
|
19
|
-
expect(evaluateExpression(condition, { status: 'INACTIVE' }, {})).toBe(false)
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
test('should evaluate == operator (equal)', () => {
|
|
23
|
-
const condition: SimpleCondition = {
|
|
24
|
-
field: 'count',
|
|
25
|
-
operator: '==',
|
|
26
|
-
value: 10,
|
|
27
|
-
}
|
|
28
|
-
expect(evaluateExpression(condition, { count: 10 }, {})).toBe(true)
|
|
29
|
-
expect(evaluateExpression(condition, { count: '10' }, {})).toBe(true) // Type coercion
|
|
30
|
-
expect(evaluateExpression(condition, { count: 5 }, {})).toBe(false)
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
test('should evaluate != operator (not equal)', () => {
|
|
34
|
-
const condition: SimpleCondition = {
|
|
35
|
-
field: 'status',
|
|
36
|
-
operator: '!=',
|
|
37
|
-
value: 'DELETED',
|
|
38
|
-
}
|
|
39
|
-
expect(evaluateExpression(condition, { status: 'ACTIVE' }, {})).toBe(true)
|
|
40
|
-
expect(evaluateExpression(condition, { status: 'DELETED' }, {})).toBe(false)
|
|
41
|
-
})
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
describe('Simple Conditions - Comparison Operators', () => {
|
|
45
|
-
test('should evaluate > operator (greater than)', () => {
|
|
46
|
-
const condition: SimpleCondition = {
|
|
47
|
-
field: 'quantity',
|
|
48
|
-
operator: '>',
|
|
49
|
-
value: 0,
|
|
50
|
-
}
|
|
51
|
-
expect(evaluateExpression(condition, { quantity: 10 }, {})).toBe(true)
|
|
52
|
-
expect(evaluateExpression(condition, { quantity: 0 }, {})).toBe(false)
|
|
53
|
-
expect(evaluateExpression(condition, { quantity: -5 }, {})).toBe(false)
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
test('should evaluate >= operator (greater than or equal)', () => {
|
|
57
|
-
const condition: SimpleCondition = {
|
|
58
|
-
field: 'price',
|
|
59
|
-
operator: '>=',
|
|
60
|
-
value: 100,
|
|
61
|
-
}
|
|
62
|
-
expect(evaluateExpression(condition, { price: 150 }, {})).toBe(true)
|
|
63
|
-
expect(evaluateExpression(condition, { price: 100 }, {})).toBe(true)
|
|
64
|
-
expect(evaluateExpression(condition, { price: 50 }, {})).toBe(false)
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
test('should evaluate < operator (less than)', () => {
|
|
68
|
-
const condition: SimpleCondition = {
|
|
69
|
-
field: 'age',
|
|
70
|
-
operator: '<',
|
|
71
|
-
value: 18,
|
|
72
|
-
}
|
|
73
|
-
expect(evaluateExpression(condition, { age: 15 }, {})).toBe(true)
|
|
74
|
-
expect(evaluateExpression(condition, { age: 18 }, {})).toBe(false)
|
|
75
|
-
expect(evaluateExpression(condition, { age: 25 }, {})).toBe(false)
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
test('should evaluate <= operator (less than or equal)', () => {
|
|
79
|
-
const condition: SimpleCondition = {
|
|
80
|
-
field: 'temperature',
|
|
81
|
-
operator: '<=',
|
|
82
|
-
value: 100,
|
|
83
|
-
}
|
|
84
|
-
expect(evaluateExpression(condition, { temperature: 50 }, {})).toBe(true)
|
|
85
|
-
expect(evaluateExpression(condition, { temperature: 100 }, {})).toBe(true)
|
|
86
|
-
expect(evaluateExpression(condition, { temperature: 150 }, {})).toBe(false)
|
|
87
|
-
})
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
describe('Simple Conditions - Collection Operators', () => {
|
|
91
|
-
test('should evaluate IN operator', () => {
|
|
92
|
-
const condition: SimpleCondition = {
|
|
93
|
-
field: 'status',
|
|
94
|
-
operator: 'IN',
|
|
95
|
-
value: ['ACTIVE', 'PENDING', 'PROCESSING'],
|
|
96
|
-
}
|
|
97
|
-
expect(evaluateExpression(condition, { status: 'ACTIVE' }, {})).toBe(true)
|
|
98
|
-
expect(evaluateExpression(condition, { status: 'PENDING' }, {})).toBe(true)
|
|
99
|
-
expect(evaluateExpression(condition, { status: 'DELETED' }, {})).toBe(false)
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
test('should evaluate NOT_IN operator', () => {
|
|
103
|
-
const condition: SimpleCondition = {
|
|
104
|
-
field: 'status',
|
|
105
|
-
operator: 'NOT_IN',
|
|
106
|
-
value: ['DELETED', 'ARCHIVED'],
|
|
107
|
-
}
|
|
108
|
-
expect(evaluateExpression(condition, { status: 'ACTIVE' }, {})).toBe(true)
|
|
109
|
-
expect(evaluateExpression(condition, { status: 'DELETED' }, {})).toBe(false)
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
test('should evaluate CONTAINS operator (array)', () => {
|
|
113
|
-
const condition: SimpleCondition = {
|
|
114
|
-
field: 'tags',
|
|
115
|
-
operator: 'CONTAINS',
|
|
116
|
-
value: 'urgent',
|
|
117
|
-
}
|
|
118
|
-
expect(evaluateExpression(condition, { tags: ['urgent', 'important'] }, {})).toBe(true)
|
|
119
|
-
expect(evaluateExpression(condition, { tags: ['normal'] }, {})).toBe(false)
|
|
120
|
-
})
|
|
121
|
-
|
|
122
|
-
test('should evaluate CONTAINS operator (string)', () => {
|
|
123
|
-
const condition: SimpleCondition = {
|
|
124
|
-
field: 'description',
|
|
125
|
-
operator: 'CONTAINS',
|
|
126
|
-
value: 'bug',
|
|
127
|
-
}
|
|
128
|
-
expect(evaluateExpression(condition, { description: 'This is a bug fix' }, {})).toBe(true)
|
|
129
|
-
expect(evaluateExpression(condition, { description: 'New feature' }, {})).toBe(false)
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
test('should evaluate NOT_CONTAINS operator', () => {
|
|
133
|
-
const condition: SimpleCondition = {
|
|
134
|
-
field: 'tags',
|
|
135
|
-
operator: 'NOT_CONTAINS',
|
|
136
|
-
value: 'deprecated',
|
|
137
|
-
}
|
|
138
|
-
expect(evaluateExpression(condition, { tags: ['new', 'stable'] }, {})).toBe(true)
|
|
139
|
-
expect(evaluateExpression(condition, { tags: ['deprecated', 'old'] }, {})).toBe(false)
|
|
140
|
-
})
|
|
141
|
-
})
|
|
142
|
-
|
|
143
|
-
describe('Simple Conditions - String Operators', () => {
|
|
144
|
-
test('should evaluate STARTS_WITH operator', () => {
|
|
145
|
-
const condition: SimpleCondition = {
|
|
146
|
-
field: 'email',
|
|
147
|
-
operator: 'STARTS_WITH',
|
|
148
|
-
value: 'admin',
|
|
149
|
-
}
|
|
150
|
-
expect(evaluateExpression(condition, { email: 'admin@example.com' }, {})).toBe(true)
|
|
151
|
-
expect(evaluateExpression(condition, { email: 'user@example.com' }, {})).toBe(false)
|
|
152
|
-
})
|
|
153
|
-
|
|
154
|
-
test('should evaluate ENDS_WITH operator', () => {
|
|
155
|
-
const condition: SimpleCondition = {
|
|
156
|
-
field: 'filename',
|
|
157
|
-
operator: 'ENDS_WITH',
|
|
158
|
-
value: '.pdf',
|
|
159
|
-
}
|
|
160
|
-
expect(evaluateExpression(condition, { filename: 'document.pdf' }, {})).toBe(true)
|
|
161
|
-
expect(evaluateExpression(condition, { filename: 'image.jpg' }, {})).toBe(false)
|
|
162
|
-
})
|
|
163
|
-
|
|
164
|
-
test('should evaluate MATCHES operator (regex)', () => {
|
|
165
|
-
const condition: SimpleCondition = {
|
|
166
|
-
field: 'code',
|
|
167
|
-
operator: 'MATCHES',
|
|
168
|
-
value: '^[A-Z]{3}-\\d{3}$',
|
|
169
|
-
}
|
|
170
|
-
expect(evaluateExpression(condition, { code: 'ABC-123' }, {})).toBe(true)
|
|
171
|
-
expect(evaluateExpression(condition, { code: 'abc-123' }, {})).toBe(false)
|
|
172
|
-
expect(evaluateExpression(condition, { code: 'XYZ' }, {})).toBe(false)
|
|
173
|
-
})
|
|
174
|
-
})
|
|
175
|
-
|
|
176
|
-
describe('Simple Conditions - Empty Operators', () => {
|
|
177
|
-
test('should evaluate IS_EMPTY operator', () => {
|
|
178
|
-
const condition: SimpleCondition = {
|
|
179
|
-
field: 'notes',
|
|
180
|
-
operator: 'IS_EMPTY',
|
|
181
|
-
value: null,
|
|
182
|
-
}
|
|
183
|
-
expect(evaluateExpression(condition, { notes: '' }, {})).toBe(true)
|
|
184
|
-
expect(evaluateExpression(condition, { notes: ' ' }, {})).toBe(true)
|
|
185
|
-
expect(evaluateExpression(condition, { notes: null }, {})).toBe(true)
|
|
186
|
-
expect(evaluateExpression(condition, { notes: undefined }, {})).toBe(true)
|
|
187
|
-
expect(evaluateExpression(condition, { notes: [] }, {})).toBe(true)
|
|
188
|
-
expect(evaluateExpression(condition, { notes: {} }, {})).toBe(true)
|
|
189
|
-
expect(evaluateExpression(condition, { notes: 'Some text' }, {})).toBe(false)
|
|
190
|
-
})
|
|
191
|
-
|
|
192
|
-
test('should evaluate IS_NOT_EMPTY operator', () => {
|
|
193
|
-
const condition: SimpleCondition = {
|
|
194
|
-
field: 'name',
|
|
195
|
-
operator: 'IS_NOT_EMPTY',
|
|
196
|
-
value: null,
|
|
197
|
-
}
|
|
198
|
-
expect(evaluateExpression(condition, { name: 'John' }, {})).toBe(true)
|
|
199
|
-
expect(evaluateExpression(condition, { name: [1, 2] }, {})).toBe(true)
|
|
200
|
-
expect(evaluateExpression(condition, { name: '' }, {})).toBe(false)
|
|
201
|
-
expect(evaluateExpression(condition, { name: null }, {})).toBe(false)
|
|
202
|
-
})
|
|
203
|
-
})
|
|
204
|
-
|
|
205
|
-
describe('Field Path Resolution', () => {
|
|
206
|
-
test('should resolve simple field paths', () => {
|
|
207
|
-
const condition: SimpleCondition = {
|
|
208
|
-
field: 'status',
|
|
209
|
-
operator: '=',
|
|
210
|
-
value: 'ACTIVE',
|
|
211
|
-
}
|
|
212
|
-
expect(evaluateExpression(condition, { status: 'ACTIVE' }, {})).toBe(true)
|
|
213
|
-
})
|
|
214
|
-
|
|
215
|
-
test('should resolve nested field paths (dot notation)', () => {
|
|
216
|
-
const condition: SimpleCondition = {
|
|
217
|
-
field: 'user.name',
|
|
218
|
-
operator: '=',
|
|
219
|
-
value: 'John',
|
|
220
|
-
}
|
|
221
|
-
const data = { user: { name: 'John', age: 30 } }
|
|
222
|
-
expect(evaluateExpression(condition, data, {})).toBe(true)
|
|
223
|
-
})
|
|
224
|
-
|
|
225
|
-
test('should resolve deeply nested paths', () => {
|
|
226
|
-
const condition: SimpleCondition = {
|
|
227
|
-
field: 'order.customer.address.city',
|
|
228
|
-
operator: '=',
|
|
229
|
-
value: 'New York',
|
|
230
|
-
}
|
|
231
|
-
const data = {
|
|
232
|
-
order: {
|
|
233
|
-
customer: {
|
|
234
|
-
address: {
|
|
235
|
-
city: 'New York',
|
|
236
|
-
zip: '10001',
|
|
237
|
-
},
|
|
238
|
-
},
|
|
239
|
-
},
|
|
240
|
-
}
|
|
241
|
-
expect(evaluateExpression(condition, data, {})).toBe(true)
|
|
242
|
-
})
|
|
243
|
-
|
|
244
|
-
test('should resolve array element by index', () => {
|
|
245
|
-
const condition: SimpleCondition = {
|
|
246
|
-
field: 'items[0]',
|
|
247
|
-
operator: '=',
|
|
248
|
-
value: 'apple',
|
|
249
|
-
}
|
|
250
|
-
const data = { items: ['apple', 'banana', 'orange'] }
|
|
251
|
-
expect(evaluateExpression(condition, data, {})).toBe(true)
|
|
252
|
-
})
|
|
253
|
-
|
|
254
|
-
test('should resolve nested array access', () => {
|
|
255
|
-
const condition: SimpleCondition = {
|
|
256
|
-
field: 'materials[0].quantity',
|
|
257
|
-
operator: '>',
|
|
258
|
-
value: 5,
|
|
259
|
-
}
|
|
260
|
-
const data = {
|
|
261
|
-
materials: [
|
|
262
|
-
{ name: 'Steel', quantity: 10 },
|
|
263
|
-
{ name: 'Wood', quantity: 3 },
|
|
264
|
-
],
|
|
265
|
-
}
|
|
266
|
-
expect(evaluateExpression(condition, data, {})).toBe(true)
|
|
267
|
-
})
|
|
268
|
-
|
|
269
|
-
test('should return undefined for non-existent paths', () => {
|
|
270
|
-
const condition: SimpleCondition = {
|
|
271
|
-
field: 'nonexistent.field',
|
|
272
|
-
operator: '=',
|
|
273
|
-
value: 'some value',
|
|
274
|
-
}
|
|
275
|
-
const data = { status: 'ACTIVE' }
|
|
276
|
-
expect(evaluateExpression(condition, data, {})).toBe(false)
|
|
277
|
-
})
|
|
278
|
-
|
|
279
|
-
test('should handle comparison of undefined to null', () => {
|
|
280
|
-
const condition: SimpleCondition = {
|
|
281
|
-
field: 'nonexistent',
|
|
282
|
-
operator: '=',
|
|
283
|
-
value: null,
|
|
284
|
-
}
|
|
285
|
-
// undefined == null is true in JavaScript (loose equality)
|
|
286
|
-
expect(evaluateExpression(condition, {}, {})).toBe(true)
|
|
287
|
-
})
|
|
288
|
-
})
|
|
289
|
-
|
|
290
|
-
describe('Field-to-Field Comparison', () => {
|
|
291
|
-
test('should compare two fields', () => {
|
|
292
|
-
const condition: SimpleCondition = {
|
|
293
|
-
field: 'actualQuantity',
|
|
294
|
-
operator: '>=',
|
|
295
|
-
valueField: 'requiredQuantity',
|
|
296
|
-
value: null,
|
|
297
|
-
}
|
|
298
|
-
expect(evaluateExpression(condition, { actualQuantity: 10, requiredQuantity: 8 }, {})).toBe(true)
|
|
299
|
-
expect(evaluateExpression(condition, { actualQuantity: 5, requiredQuantity: 10 }, {})).toBe(false)
|
|
300
|
-
})
|
|
301
|
-
|
|
302
|
-
test('should compare nested fields', () => {
|
|
303
|
-
const condition: SimpleCondition = {
|
|
304
|
-
field: 'user.role',
|
|
305
|
-
operator: '=',
|
|
306
|
-
valueField: 'requiredRole',
|
|
307
|
-
value: null,
|
|
308
|
-
}
|
|
309
|
-
const data = {
|
|
310
|
-
user: { role: 'admin' },
|
|
311
|
-
requiredRole: 'admin',
|
|
312
|
-
}
|
|
313
|
-
expect(evaluateExpression(condition, data, {})).toBe(true)
|
|
314
|
-
})
|
|
315
|
-
})
|
|
316
|
-
|
|
317
|
-
describe('Special Value Resolution', () => {
|
|
318
|
-
test('should resolve {{today}} to current date', () => {
|
|
319
|
-
const condition: SimpleCondition = {
|
|
320
|
-
field: 'dueDate',
|
|
321
|
-
operator: '>=',
|
|
322
|
-
value: '{{today}}',
|
|
323
|
-
}
|
|
324
|
-
const today = new Date().toISOString().split('T')[0]
|
|
325
|
-
const tomorrow = new Date(Date.now() + 86400000).toISOString().split('T')[0]
|
|
326
|
-
const yesterday = new Date(Date.now() - 86400000).toISOString().split('T')[0]
|
|
327
|
-
|
|
328
|
-
expect(evaluateExpression(condition, { dueDate: tomorrow }, {})).toBe(true)
|
|
329
|
-
expect(evaluateExpression(condition, { dueDate: today }, {})).toBe(true)
|
|
330
|
-
expect(evaluateExpression(condition, { dueDate: yesterday }, {})).toBe(false)
|
|
331
|
-
})
|
|
332
|
-
|
|
333
|
-
test('should resolve {{now}} to current timestamp', () => {
|
|
334
|
-
const condition: SimpleCondition = {
|
|
335
|
-
field: 'timestamp',
|
|
336
|
-
operator: '=',
|
|
337
|
-
value: '{{now}}',
|
|
338
|
-
}
|
|
339
|
-
const context = {
|
|
340
|
-
now: new Date('2025-01-01T12:00:00Z'),
|
|
341
|
-
}
|
|
342
|
-
expect(evaluateExpression(condition, { timestamp: '2025-01-01T12:00:00.000Z' }, context)).toBe(true)
|
|
343
|
-
})
|
|
344
|
-
|
|
345
|
-
test('should resolve {{user.id}} from context', () => {
|
|
346
|
-
const condition: SimpleCondition = {
|
|
347
|
-
field: 'assignedTo',
|
|
348
|
-
operator: '=',
|
|
349
|
-
value: '{{user.id}}',
|
|
350
|
-
}
|
|
351
|
-
const context: EvaluationContext = {
|
|
352
|
-
user: { id: 'user-123', email: 'user@example.com' },
|
|
353
|
-
}
|
|
354
|
-
expect(evaluateExpression(condition, { assignedTo: 'user-123' }, context)).toBe(true)
|
|
355
|
-
expect(evaluateExpression(condition, { assignedTo: 'user-456' }, context)).toBe(false)
|
|
356
|
-
})
|
|
357
|
-
|
|
358
|
-
test('should resolve {{tenant.id}} from context', () => {
|
|
359
|
-
const condition: SimpleCondition = {
|
|
360
|
-
field: 'tenantId',
|
|
361
|
-
operator: '=',
|
|
362
|
-
value: '{{tenant.id}}',
|
|
363
|
-
}
|
|
364
|
-
const context: EvaluationContext = {
|
|
365
|
-
tenant: { id: 'tenant-abc' },
|
|
366
|
-
}
|
|
367
|
-
expect(evaluateExpression(condition, { tenantId: 'tenant-abc' }, context)).toBe(true)
|
|
368
|
-
})
|
|
369
|
-
})
|
|
370
|
-
|
|
371
|
-
describe('Group Conditions - AND Operator', () => {
|
|
372
|
-
test('should evaluate AND with all conditions true', () => {
|
|
373
|
-
const condition: GroupCondition = {
|
|
374
|
-
operator: 'AND',
|
|
375
|
-
rules: [
|
|
376
|
-
{ field: 'status', operator: '=', value: 'ACTIVE' },
|
|
377
|
-
{ field: 'quantity', operator: '>', value: 0 },
|
|
378
|
-
],
|
|
379
|
-
}
|
|
380
|
-
const data = { status: 'ACTIVE', quantity: 10 }
|
|
381
|
-
expect(evaluateExpression(condition, data, {})).toBe(true)
|
|
382
|
-
})
|
|
383
|
-
|
|
384
|
-
test('should evaluate AND with one condition false', () => {
|
|
385
|
-
const condition: GroupCondition = {
|
|
386
|
-
operator: 'AND',
|
|
387
|
-
rules: [
|
|
388
|
-
{ field: 'status', operator: '=', value: 'ACTIVE' },
|
|
389
|
-
{ field: 'quantity', operator: '>', value: 0 },
|
|
390
|
-
],
|
|
391
|
-
}
|
|
392
|
-
const data = { status: 'ACTIVE', quantity: 0 }
|
|
393
|
-
expect(evaluateExpression(condition, data, {})).toBe(false)
|
|
394
|
-
})
|
|
395
|
-
|
|
396
|
-
test('should evaluate AND with empty rules', () => {
|
|
397
|
-
const condition: GroupCondition = {
|
|
398
|
-
operator: 'AND',
|
|
399
|
-
rules: [],
|
|
400
|
-
}
|
|
401
|
-
expect(evaluateExpression(condition, {}, {})).toBe(true)
|
|
402
|
-
})
|
|
403
|
-
})
|
|
404
|
-
|
|
405
|
-
describe('Group Conditions - OR Operator', () => {
|
|
406
|
-
test('should evaluate OR with one condition true', () => {
|
|
407
|
-
const condition: GroupCondition = {
|
|
408
|
-
operator: 'OR',
|
|
409
|
-
rules: [
|
|
410
|
-
{ field: 'status', operator: '=', value: 'URGENT' },
|
|
411
|
-
{ field: 'priority', operator: '=', value: 'HIGH' },
|
|
412
|
-
],
|
|
413
|
-
}
|
|
414
|
-
const data = { status: 'NORMAL', priority: 'HIGH' }
|
|
415
|
-
expect(evaluateExpression(condition, data, {})).toBe(true)
|
|
416
|
-
})
|
|
417
|
-
|
|
418
|
-
test('should evaluate OR with all conditions false', () => {
|
|
419
|
-
const condition: GroupCondition = {
|
|
420
|
-
operator: 'OR',
|
|
421
|
-
rules: [
|
|
422
|
-
{ field: 'status', operator: '=', value: 'URGENT' },
|
|
423
|
-
{ field: 'priority', operator: '=', value: 'HIGH' },
|
|
424
|
-
],
|
|
425
|
-
}
|
|
426
|
-
const data = { status: 'NORMAL', priority: 'LOW' }
|
|
427
|
-
expect(evaluateExpression(condition, data, {})).toBe(false)
|
|
428
|
-
})
|
|
429
|
-
})
|
|
430
|
-
|
|
431
|
-
describe('Group Conditions - NOT Operator', () => {
|
|
432
|
-
test('should evaluate NOT with single rule', () => {
|
|
433
|
-
const condition: GroupCondition = {
|
|
434
|
-
operator: 'NOT',
|
|
435
|
-
rules: [{ field: 'status', operator: '=', value: 'DELETED' }],
|
|
436
|
-
}
|
|
437
|
-
expect(evaluateExpression(condition, { status: 'ACTIVE' }, {})).toBe(true)
|
|
438
|
-
expect(evaluateExpression(condition, { status: 'DELETED' }, {})).toBe(false)
|
|
439
|
-
})
|
|
440
|
-
|
|
441
|
-
test('should evaluate NOT with multiple rules (combined with AND)', () => {
|
|
442
|
-
const condition: GroupCondition = {
|
|
443
|
-
operator: 'NOT',
|
|
444
|
-
rules: [
|
|
445
|
-
{ field: 'status', operator: '=', value: 'DELETED' },
|
|
446
|
-
{ field: 'archived', operator: '=', value: true },
|
|
447
|
-
],
|
|
448
|
-
}
|
|
449
|
-
expect(evaluateExpression(condition, { status: 'ACTIVE', archived: false }, {})).toBe(true)
|
|
450
|
-
expect(evaluateExpression(condition, { status: 'DELETED', archived: true }, {})).toBe(false)
|
|
451
|
-
})
|
|
452
|
-
})
|
|
453
|
-
|
|
454
|
-
describe('Nested Group Conditions', () => {
|
|
455
|
-
test('should evaluate nested AND and OR conditions', () => {
|
|
456
|
-
const condition: GroupCondition = {
|
|
457
|
-
operator: 'AND',
|
|
458
|
-
rules: [
|
|
459
|
-
{ field: 'status', operator: '=', value: 'ACTIVE' },
|
|
460
|
-
{
|
|
461
|
-
operator: 'OR',
|
|
462
|
-
rules: [
|
|
463
|
-
{ field: 'priority', operator: '=', value: 'HIGH' },
|
|
464
|
-
{ field: 'urgent', operator: '=', value: true },
|
|
465
|
-
],
|
|
466
|
-
},
|
|
467
|
-
],
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
expect(evaluateExpression(condition, { status: 'ACTIVE', priority: 'HIGH' }, {})).toBe(true)
|
|
471
|
-
expect(evaluateExpression(condition, { status: 'ACTIVE', urgent: true }, {})).toBe(true)
|
|
472
|
-
expect(evaluateExpression(condition, { status: 'ACTIVE', priority: 'LOW', urgent: false }, {})).toBe(false)
|
|
473
|
-
expect(evaluateExpression(condition, { status: 'INACTIVE', priority: 'HIGH' }, {})).toBe(false)
|
|
474
|
-
})
|
|
475
|
-
|
|
476
|
-
test('should evaluate deeply nested conditions', () => {
|
|
477
|
-
const condition: GroupCondition = {
|
|
478
|
-
operator: 'OR',
|
|
479
|
-
rules: [
|
|
480
|
-
{
|
|
481
|
-
operator: 'AND',
|
|
482
|
-
rules: [
|
|
483
|
-
{ field: 'type', operator: '=', value: 'urgent' },
|
|
484
|
-
{ field: 'severity', operator: '=', value: 'critical' },
|
|
485
|
-
],
|
|
486
|
-
},
|
|
487
|
-
{
|
|
488
|
-
operator: 'AND',
|
|
489
|
-
rules: [
|
|
490
|
-
{ field: 'type', operator: '=', value: 'scheduled' },
|
|
491
|
-
{ field: 'approved', operator: '=', value: true },
|
|
492
|
-
],
|
|
493
|
-
},
|
|
494
|
-
],
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
expect(evaluateExpression(condition, { type: 'urgent', severity: 'critical' }, {})).toBe(true)
|
|
498
|
-
expect(evaluateExpression(condition, { type: 'scheduled', approved: true }, {})).toBe(true)
|
|
499
|
-
expect(evaluateExpression(condition, { type: 'urgent', severity: 'low' }, {})).toBe(false)
|
|
500
|
-
expect(evaluateExpression(condition, { type: 'scheduled', approved: false }, {})).toBe(false)
|
|
501
|
-
})
|
|
502
|
-
})
|
|
503
|
-
|
|
504
|
-
describe('Edge Cases', () => {
|
|
505
|
-
test('should handle null values', () => {
|
|
506
|
-
const condition: SimpleCondition = {
|
|
507
|
-
field: 'value',
|
|
508
|
-
operator: '=',
|
|
509
|
-
value: null,
|
|
510
|
-
}
|
|
511
|
-
expect(evaluateExpression(condition, { value: null }, {})).toBe(true)
|
|
512
|
-
expect(evaluateExpression(condition, { value: 'something' }, {})).toBe(false)
|
|
513
|
-
})
|
|
514
|
-
|
|
515
|
-
test('should handle undefined values', () => {
|
|
516
|
-
const condition: SimpleCondition = {
|
|
517
|
-
field: 'missing',
|
|
518
|
-
operator: 'IS_EMPTY',
|
|
519
|
-
value: null,
|
|
520
|
-
}
|
|
521
|
-
expect(evaluateExpression(condition, {}, {})).toBe(true)
|
|
522
|
-
})
|
|
523
|
-
|
|
524
|
-
test('should handle type coercion for numbers', () => {
|
|
525
|
-
const condition: SimpleCondition = {
|
|
526
|
-
field: 'count',
|
|
527
|
-
operator: '=',
|
|
528
|
-
value: 10,
|
|
529
|
-
}
|
|
530
|
-
expect(evaluateExpression(condition, { count: '10' }, {})).toBe(true)
|
|
531
|
-
})
|
|
532
|
-
|
|
533
|
-
test('should handle date string comparisons', () => {
|
|
534
|
-
const condition: SimpleCondition = {
|
|
535
|
-
field: 'date',
|
|
536
|
-
operator: '>',
|
|
537
|
-
value: '2025-01-01',
|
|
538
|
-
}
|
|
539
|
-
expect(evaluateExpression(condition, { date: '2025-01-15' }, {})).toBe(true)
|
|
540
|
-
expect(evaluateExpression(condition, { date: '2024-12-15' }, {})).toBe(false)
|
|
541
|
-
})
|
|
542
|
-
|
|
543
|
-
test('should handle invalid regex patterns gracefully', () => {
|
|
544
|
-
const condition: SimpleCondition = {
|
|
545
|
-
field: 'text',
|
|
546
|
-
operator: 'MATCHES',
|
|
547
|
-
value: '[invalid',
|
|
548
|
-
}
|
|
549
|
-
expect(evaluateExpression(condition, { text: 'anything' }, {})).toBe(false)
|
|
550
|
-
})
|
|
551
|
-
})
|
|
552
|
-
|
|
553
|
-
describe('Security - ReDoS Protection', () => {
|
|
554
|
-
test('should reject overly long regex patterns', () => {
|
|
555
|
-
const longPattern = 'a'.repeat(300)
|
|
556
|
-
const condition: SimpleCondition = {
|
|
557
|
-
field: 'text',
|
|
558
|
-
operator: 'MATCHES',
|
|
559
|
-
value: longPattern,
|
|
560
|
-
}
|
|
561
|
-
expect(evaluateExpression(condition, { text: 'test' }, {})).toBe(false)
|
|
562
|
-
})
|
|
563
|
-
|
|
564
|
-
test('should reject dangerous exponential backtracking patterns', () => {
|
|
565
|
-
const dangerousPatterns = [
|
|
566
|
-
'(a+)+',
|
|
567
|
-
'(a*)*',
|
|
568
|
-
'(a+)*',
|
|
569
|
-
'(.*)*',
|
|
570
|
-
]
|
|
571
|
-
|
|
572
|
-
dangerousPatterns.forEach(pattern => {
|
|
573
|
-
const condition: SimpleCondition = {
|
|
574
|
-
field: 'text',
|
|
575
|
-
operator: 'MATCHES',
|
|
576
|
-
value: pattern,
|
|
577
|
-
}
|
|
578
|
-
expect(evaluateExpression(condition, { text: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaa' }, {})).toBe(false)
|
|
579
|
-
})
|
|
580
|
-
})
|
|
581
|
-
|
|
582
|
-
test('should allow safe regex patterns', () => {
|
|
583
|
-
const condition: SimpleCondition = {
|
|
584
|
-
field: 'email',
|
|
585
|
-
operator: 'MATCHES',
|
|
586
|
-
value: '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$',
|
|
587
|
-
}
|
|
588
|
-
expect(evaluateExpression(condition, { email: 'user@example.com' }, {})).toBe(true)
|
|
589
|
-
expect(evaluateExpression(condition, { email: 'invalid-email' }, {})).toBe(false)
|
|
590
|
-
})
|
|
591
|
-
})
|
|
592
|
-
})
|