@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,37 +0,0 @@
|
|
|
1
|
-
jest.mock('@open-mercato/ui/backend/CrudForm', () => ({
|
|
2
|
-
CrudForm: () => null,
|
|
3
|
-
}))
|
|
4
|
-
|
|
5
|
-
import { z } from 'zod'
|
|
6
|
-
import { buildActivityValidationError } from '../ActivityForm'
|
|
7
|
-
|
|
8
|
-
describe('buildActivityValidationError', () => {
|
|
9
|
-
const t = (key: string, fallback?: string) => fallback ?? key
|
|
10
|
-
|
|
11
|
-
it('throws CrudFormError with field mapping when available', () => {
|
|
12
|
-
const issue: z.ZodIssue = {
|
|
13
|
-
code: z.ZodIssueCode.custom,
|
|
14
|
-
message: 'Activity type is required',
|
|
15
|
-
path: ['activityType'],
|
|
16
|
-
}
|
|
17
|
-
const thrower = () => buildActivityValidationError([issue], t)
|
|
18
|
-
expect(thrower).toThrow('Activity type is required')
|
|
19
|
-
try {
|
|
20
|
-
thrower()
|
|
21
|
-
} catch (error) {
|
|
22
|
-
expect(error).toMatchObject({
|
|
23
|
-
message: 'Activity type is required',
|
|
24
|
-
fieldErrors: { activityType: 'Activity type is required' },
|
|
25
|
-
})
|
|
26
|
-
}
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
it('uses fallback message when missing', () => {
|
|
30
|
-
const issue: z.ZodIssue = {
|
|
31
|
-
code: z.ZodIssueCode.custom,
|
|
32
|
-
message: undefined as unknown as string,
|
|
33
|
-
path: [],
|
|
34
|
-
}
|
|
35
|
-
expect(() => buildActivityValidationError([issue], t)).toThrow('customers.people.detail.activities.error')
|
|
36
|
-
})
|
|
37
|
-
})
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
jest.mock('@open-mercato/ui/backend/CrudForm', () => ({
|
|
2
|
-
CrudForm: () => null,
|
|
3
|
-
}))
|
|
4
|
-
jest.mock('react-markdown', () => ({
|
|
5
|
-
__esModule: true,
|
|
6
|
-
default: () => null,
|
|
7
|
-
}))
|
|
8
|
-
jest.mock('remark-gfm', () => ({
|
|
9
|
-
__esModule: true,
|
|
10
|
-
default: () => undefined,
|
|
11
|
-
}))
|
|
12
|
-
|
|
13
|
-
import { z } from 'zod'
|
|
14
|
-
import { buildDealValidationError } from '../DealForm'
|
|
15
|
-
|
|
16
|
-
describe('buildDealValidationError', () => {
|
|
17
|
-
const t = (key: string, fallback?: string) => fallback ?? key
|
|
18
|
-
|
|
19
|
-
it('throws CrudFormError with message and field when available', () => {
|
|
20
|
-
const issue: z.ZodIssue = {
|
|
21
|
-
code: z.ZodIssueCode.custom,
|
|
22
|
-
message: 'Title is required',
|
|
23
|
-
path: ['title'],
|
|
24
|
-
}
|
|
25
|
-
const thrower = () => buildDealValidationError([issue], t)
|
|
26
|
-
expect(thrower).toThrow('Title is required')
|
|
27
|
-
try {
|
|
28
|
-
thrower()
|
|
29
|
-
} catch (error) {
|
|
30
|
-
expect(error).toMatchObject({
|
|
31
|
-
message: 'Title is required',
|
|
32
|
-
fieldErrors: { title: 'Title is required' },
|
|
33
|
-
})
|
|
34
|
-
}
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
it('throws with fallback message when issue is missing', () => {
|
|
38
|
-
const issue: z.ZodIssue = {
|
|
39
|
-
code: z.ZodIssueCode.custom,
|
|
40
|
-
message: undefined as unknown as string,
|
|
41
|
-
path: [],
|
|
42
|
-
}
|
|
43
|
-
expect(() => buildDealValidationError([issue], t)).toThrow('Failed to save deal.')
|
|
44
|
-
})
|
|
45
|
-
})
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jest-environment jsdom
|
|
3
|
-
*/
|
|
4
|
-
import * as React from 'react'
|
|
5
|
-
import { fireEvent, render, screen } from '@testing-library/react'
|
|
6
|
-
import { InlineMultilineEditor, InlineTextEditor, renderMultilineMarkdownDisplay } from '../InlineEditors'
|
|
7
|
-
|
|
8
|
-
// jsdom does not provide requestAnimationFrame by default.
|
|
9
|
-
;(global as any).requestAnimationFrame =
|
|
10
|
-
(global as any).requestAnimationFrame || ((cb: FrameRequestCallback) => setTimeout(cb, 0))
|
|
11
|
-
|
|
12
|
-
const reactMarkdownMock = jest.fn((props: any) => <div data-testid="react-markdown">{props.children}</div>)
|
|
13
|
-
|
|
14
|
-
jest.mock('react-markdown', () => ({
|
|
15
|
-
__esModule: true,
|
|
16
|
-
default: (props: any) => reactMarkdownMock(props),
|
|
17
|
-
}))
|
|
18
|
-
|
|
19
|
-
jest.mock('remark-gfm', () => ({
|
|
20
|
-
__esModule: true,
|
|
21
|
-
default: () => null,
|
|
22
|
-
}))
|
|
23
|
-
|
|
24
|
-
jest.mock('next/dynamic', () => () => {
|
|
25
|
-
return function MockDynamicComponent(props: any) {
|
|
26
|
-
return <div data-testid="dynamic-import" {...props} />
|
|
27
|
-
}
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
jest.mock('@uiw/react-md-editor', () => (props: any) => {
|
|
31
|
-
return <textarea data-testid="markdown-editor" value={props.value ?? ''} onChange={(event) => props.onChange?.(event.target.value)} />
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
jest.mock('@open-mercato/ui/primitives/button', () => ({
|
|
35
|
-
Button: ({ children, ...props }: any) => (
|
|
36
|
-
<button type={props.type || 'button'} {...props}>
|
|
37
|
-
{children}
|
|
38
|
-
</button>
|
|
39
|
-
),
|
|
40
|
-
}))
|
|
41
|
-
|
|
42
|
-
jest.mock('@open-mercato/ui/backend/detail', () => ({
|
|
43
|
-
LoadingMessage: ({ label }: { label?: string }) => <div>{label ?? 'loading'}</div>,
|
|
44
|
-
}))
|
|
45
|
-
|
|
46
|
-
jest.mock('@open-mercato/ui/backend/FlashMessages', () => ({
|
|
47
|
-
flash: jest.fn(),
|
|
48
|
-
}))
|
|
49
|
-
|
|
50
|
-
jest.mock('@open-mercato/ui/backend/inputs/PhoneNumberField', () => ({
|
|
51
|
-
PhoneNumberField: ({ value, onValueChange, placeholder }: any) => (
|
|
52
|
-
<input
|
|
53
|
-
data-testid="phone-input"
|
|
54
|
-
value={value ?? ''}
|
|
55
|
-
onChange={(event) => onValueChange?.(event.target.value)}
|
|
56
|
-
placeholder={placeholder}
|
|
57
|
-
/>
|
|
58
|
-
),
|
|
59
|
-
}))
|
|
60
|
-
|
|
61
|
-
jest.mock('@tanstack/react-query', () => ({
|
|
62
|
-
useQueryClient: () => ({
|
|
63
|
-
invalidateQueries: jest.fn(),
|
|
64
|
-
}),
|
|
65
|
-
}))
|
|
66
|
-
|
|
67
|
-
jest.mock('@open-mercato/shared/lib/i18n/context', () => ({
|
|
68
|
-
useT: () => (key: string, fallback?: string) => fallback ?? key,
|
|
69
|
-
}))
|
|
70
|
-
|
|
71
|
-
jest.mock('../../../backend/hooks/useEmailDuplicateCheck', () => ({
|
|
72
|
-
useEmailDuplicateCheck: () => ({ duplicate: null, checking: false }),
|
|
73
|
-
}))
|
|
74
|
-
|
|
75
|
-
jest.mock('../../../utils/phoneDuplicates', () => ({
|
|
76
|
-
lookupPhoneDuplicate: jest.fn(),
|
|
77
|
-
}))
|
|
78
|
-
|
|
79
|
-
jest.mock('@open-mercato/core/modules/dictionaries/components/AppearanceSelector', () => ({
|
|
80
|
-
AppearanceSelector: ({ children }: { children?: React.ReactNode }) => <div>{children}</div>,
|
|
81
|
-
}))
|
|
82
|
-
|
|
83
|
-
jest.mock('@open-mercato/shared/lib/i18n/context', () => ({
|
|
84
|
-
useT: () => (key: string, fallback?: string) => fallback ?? key,
|
|
85
|
-
}))
|
|
86
|
-
|
|
87
|
-
describe('Inline multiline editors', () => {
|
|
88
|
-
it('renders markdown preview and falls back to empty label', () => {
|
|
89
|
-
const { rerender } = render(
|
|
90
|
-
<>
|
|
91
|
-
{renderMultilineMarkdownDisplay({
|
|
92
|
-
value: 'Hello **world**',
|
|
93
|
-
emptyLabel: 'Empty state',
|
|
94
|
-
})}
|
|
95
|
-
</>,
|
|
96
|
-
)
|
|
97
|
-
|
|
98
|
-
expect(reactMarkdownMock).toHaveBeenCalledWith(
|
|
99
|
-
expect.objectContaining({
|
|
100
|
-
children: 'Hello **world**',
|
|
101
|
-
remarkPlugins: expect.any(Array),
|
|
102
|
-
}),
|
|
103
|
-
)
|
|
104
|
-
|
|
105
|
-
rerender(
|
|
106
|
-
<>
|
|
107
|
-
{renderMultilineMarkdownDisplay({
|
|
108
|
-
value: ' ',
|
|
109
|
-
emptyLabel: 'Empty state',
|
|
110
|
-
})}
|
|
111
|
-
</>,
|
|
112
|
-
)
|
|
113
|
-
|
|
114
|
-
expect(screen.getByText('Empty state')).toBeInTheDocument()
|
|
115
|
-
})
|
|
116
|
-
|
|
117
|
-
it('activates edit mode on click and shows save shortcut label', () => {
|
|
118
|
-
const handleSave = jest.fn().mockResolvedValue(undefined)
|
|
119
|
-
const { container } = render(
|
|
120
|
-
<InlineMultilineEditor
|
|
121
|
-
label="Description"
|
|
122
|
-
value="Link text"
|
|
123
|
-
placeholder="Description"
|
|
124
|
-
emptyLabel="No description"
|
|
125
|
-
onSave={handleSave}
|
|
126
|
-
renderDisplay={({ value }) => (
|
|
127
|
-
<a href="https://example.com" data-testid="description-link">
|
|
128
|
-
{value}
|
|
129
|
-
</a>
|
|
130
|
-
)}
|
|
131
|
-
activateOnClick
|
|
132
|
-
/>,
|
|
133
|
-
)
|
|
134
|
-
|
|
135
|
-
const wrapper = container.firstChild as HTMLElement
|
|
136
|
-
expect(wrapper).toHaveClass('cursor-pointer')
|
|
137
|
-
|
|
138
|
-
const link = screen.getByTestId('description-link')
|
|
139
|
-
fireEvent.click(link)
|
|
140
|
-
|
|
141
|
-
expect(screen.getByRole('textbox')).toBeInTheDocument()
|
|
142
|
-
expect(screen.getByText('Save ⌘⏎ / Ctrl+Enter')).toBeInTheDocument()
|
|
143
|
-
})
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
describe('Inline text editor', () => {
|
|
147
|
-
it('renders save shortcut label with fallback text', () => {
|
|
148
|
-
const handleSave = jest.fn().mockResolvedValue(undefined)
|
|
149
|
-
render(
|
|
150
|
-
<InlineTextEditor
|
|
151
|
-
label="Domain"
|
|
152
|
-
value="https://example.com"
|
|
153
|
-
placeholder="Domain"
|
|
154
|
-
emptyLabel="No domain"
|
|
155
|
-
onSave={handleSave}
|
|
156
|
-
activateOnClick
|
|
157
|
-
type="url"
|
|
158
|
-
/>,
|
|
159
|
-
)
|
|
160
|
-
|
|
161
|
-
fireEvent.click(screen.getByRole('link'))
|
|
162
|
-
|
|
163
|
-
expect(screen.getByRole('textbox')).toBeInTheDocument()
|
|
164
|
-
expect(screen.getByText('Save ⌘⏎ / Ctrl+Enter')).toBeInTheDocument()
|
|
165
|
-
})
|
|
166
|
-
})
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
jest.mock('@open-mercato/ui/backend/CrudForm', () => ({
|
|
2
|
-
CrudForm: () => null,
|
|
3
|
-
}))
|
|
4
|
-
|
|
5
|
-
import { buildTaskSubmitPayload } from '../TaskForm'
|
|
6
|
-
|
|
7
|
-
describe('buildTaskSubmitPayload', () => {
|
|
8
|
-
const t = (key: string, fallback?: string) => fallback ?? key
|
|
9
|
-
|
|
10
|
-
it('throws when title is missing', () => {
|
|
11
|
-
expect(() => buildTaskSubmitPayload({}, t)).toThrow('Task name is required.')
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
it('returns normalized payload when title is provided', () => {
|
|
15
|
-
const payload = buildTaskSubmitPayload({ title: ' Follow up ', is_done: true, cf_priority: 'high' }, t)
|
|
16
|
-
expect(payload).toEqual({
|
|
17
|
-
base: { title: 'Follow up', is_done: true },
|
|
18
|
-
custom: { priority: 'high' },
|
|
19
|
-
})
|
|
20
|
-
})
|
|
21
|
-
})
|
package/src/modules/customers/components/detail/hooks/__tests__/useCustomerDictionary.test.ts
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { QueryClient } from '@tanstack/query-core'
|
|
2
|
-
import {
|
|
3
|
-
ensureCustomerDictionary,
|
|
4
|
-
invalidateCustomerDictionary,
|
|
5
|
-
} from '../useCustomerDictionary'
|
|
6
|
-
|
|
7
|
-
jest.mock('@open-mercato/ui/backend/utils/apiCall', () => ({
|
|
8
|
-
readApiResultOrThrow: jest.fn(),
|
|
9
|
-
}))
|
|
10
|
-
|
|
11
|
-
import { readApiResultOrThrow } from '@open-mercato/ui/backend/utils/apiCall'
|
|
12
|
-
|
|
13
|
-
const mockReadApiResultOrThrow = readApiResultOrThrow as jest.Mock
|
|
14
|
-
|
|
15
|
-
const createApiResponse = (items: unknown[]) => ({ items })
|
|
16
|
-
|
|
17
|
-
describe('ensureCustomerDictionary', () => {
|
|
18
|
-
let queryClient: QueryClient
|
|
19
|
-
|
|
20
|
-
beforeEach(() => {
|
|
21
|
-
queryClient = new QueryClient()
|
|
22
|
-
mockReadApiResultOrThrow.mockReset()
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
afterEach(() => {
|
|
26
|
-
queryClient?.clear?.()
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
it('normalizes API payload into dictionary data', async () => {
|
|
30
|
-
mockReadApiResultOrThrow.mockResolvedValueOnce(
|
|
31
|
-
createApiResponse([
|
|
32
|
-
{
|
|
33
|
-
id: 'status-1',
|
|
34
|
-
value: 'new',
|
|
35
|
-
label: 'New',
|
|
36
|
-
color: '#AABBCC',
|
|
37
|
-
icon: '⭐',
|
|
38
|
-
organizationId: 'org-123',
|
|
39
|
-
isInherited: false,
|
|
40
|
-
},
|
|
41
|
-
]),
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
const result = await ensureCustomerDictionary(queryClient, 'statuses', 0)
|
|
45
|
-
|
|
46
|
-
expect(mockReadApiResultOrThrow).toHaveBeenCalledWith(
|
|
47
|
-
'/api/customers/dictionaries/statuses',
|
|
48
|
-
undefined,
|
|
49
|
-
{ errorMessage: 'Failed to load dictionary entries.' },
|
|
50
|
-
)
|
|
51
|
-
expect(result.entries).toEqual([
|
|
52
|
-
{ value: 'new', label: 'New', color: '#aabbcc', icon: '⭐' },
|
|
53
|
-
])
|
|
54
|
-
expect(result.map['new']).toEqual({ value: 'new', label: 'New', color: '#aabbcc', icon: '⭐' })
|
|
55
|
-
expect(result.fullEntries[0]).toMatchObject({
|
|
56
|
-
id: 'status-1',
|
|
57
|
-
value: 'new',
|
|
58
|
-
label: 'New',
|
|
59
|
-
color: '#aabbcc',
|
|
60
|
-
icon: '⭐',
|
|
61
|
-
organizationId: 'org-123',
|
|
62
|
-
isInherited: false,
|
|
63
|
-
})
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
it('refetches freshly after invalidation and returns updated entries', async () => {
|
|
67
|
-
mockReadApiResultOrThrow
|
|
68
|
-
.mockResolvedValueOnce(createApiResponse([{ id: 'status-1', value: 'alpha', label: 'Alpha' }]))
|
|
69
|
-
.mockResolvedValueOnce(createApiResponse([{ id: 'status-2', value: 'beta', label: 'Beta' }]))
|
|
70
|
-
|
|
71
|
-
const first = await ensureCustomerDictionary(queryClient, 'statuses', 0)
|
|
72
|
-
expect(first.entries.map((entry) => entry.value)).toEqual(['alpha'])
|
|
73
|
-
expect(mockReadApiResultOrThrow).toHaveBeenCalledTimes(1)
|
|
74
|
-
|
|
75
|
-
await invalidateCustomerDictionary(queryClient, 'statuses')
|
|
76
|
-
|
|
77
|
-
const second = await ensureCustomerDictionary(queryClient, 'statuses', 0)
|
|
78
|
-
expect(mockReadApiResultOrThrow).toHaveBeenCalledTimes(2)
|
|
79
|
-
expect(second.entries.map((entry) => entry.value)).toEqual(['beta'])
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
it('isolates cached data per scope version', async () => {
|
|
83
|
-
mockReadApiResultOrThrow
|
|
84
|
-
.mockResolvedValueOnce(createApiResponse([{ id: 'source-1', value: 'scope-0', label: 'Scope Zero' }]))
|
|
85
|
-
.mockResolvedValueOnce(createApiResponse([{ id: 'source-2', value: 'scope-1', label: 'Scope One' }]))
|
|
86
|
-
|
|
87
|
-
const scopeZero = await ensureCustomerDictionary(queryClient, 'sources', 0)
|
|
88
|
-
expect(scopeZero.entries[0]?.value).toBe('scope-0')
|
|
89
|
-
|
|
90
|
-
const scopeOne = await ensureCustomerDictionary(queryClient, 'sources', 1)
|
|
91
|
-
expect(scopeOne.entries[0]?.value).toBe('scope-1')
|
|
92
|
-
|
|
93
|
-
const cachedKeys = queryClient.getQueryCache().findAll().map((query) => query.queryKey)
|
|
94
|
-
expect(cachedKeys).toContainEqual(['customers', 'dictionaries', 'sources', 'scope:0'])
|
|
95
|
-
expect(cachedKeys).toContainEqual(['customers', 'dictionaries', 'sources', 'scope:1'])
|
|
96
|
-
})
|
|
97
|
-
})
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CUSTOMER_ENTITY_ID,
|
|
3
|
-
PERSON_ENTITY_ID,
|
|
4
|
-
resolvePersonCustomFieldRouting,
|
|
5
|
-
mergePersonCustomFieldValues,
|
|
6
|
-
} from '../customFieldRouting'
|
|
7
|
-
import { CustomFieldDef } from '@open-mercato/core/modules/entities/data/entities'
|
|
8
|
-
|
|
9
|
-
describe('customers lib - custom field routing', () => {
|
|
10
|
-
it('prefers definitions with higher score and lower penalty', async () => {
|
|
11
|
-
const find = jest.fn().mockResolvedValue([
|
|
12
|
-
{
|
|
13
|
-
id: 'def-1',
|
|
14
|
-
key: 'priority',
|
|
15
|
-
kind: 'dictionary',
|
|
16
|
-
configJson: JSON.stringify({ filterable: true, priority: 5 }),
|
|
17
|
-
entityId: CUSTOMER_ENTITY_ID,
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
id: 'def-2',
|
|
21
|
-
key: 'priority',
|
|
22
|
-
kind: 'dictionary',
|
|
23
|
-
configJson: JSON.stringify({ filterable: true, priority: 1 }),
|
|
24
|
-
entityId: PERSON_ENTITY_ID,
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
id: 'def-3',
|
|
28
|
-
key: 'notes',
|
|
29
|
-
kind: 'multiline',
|
|
30
|
-
configJson: null,
|
|
31
|
-
entityId: PERSON_ENTITY_ID,
|
|
32
|
-
},
|
|
33
|
-
])
|
|
34
|
-
|
|
35
|
-
const em = { find } as unknown as Parameters<typeof resolvePersonCustomFieldRouting>[0]
|
|
36
|
-
|
|
37
|
-
const routing = await resolvePersonCustomFieldRouting(em, 'tenant-1', 'org-1')
|
|
38
|
-
|
|
39
|
-
expect(find).toHaveBeenCalledTimes(1)
|
|
40
|
-
const [, where] = find.mock.calls[0]
|
|
41
|
-
expect(where).toMatchObject({
|
|
42
|
-
entityId: { $in: expect.arrayContaining([CUSTOMER_ENTITY_ID, PERSON_ENTITY_ID]) },
|
|
43
|
-
deletedAt: null,
|
|
44
|
-
isActive: true,
|
|
45
|
-
})
|
|
46
|
-
expect(where.$and).toEqual(
|
|
47
|
-
expect.arrayContaining([
|
|
48
|
-
{ $or: [{ tenantId: 'tenant-1' }, { tenantId: null }] },
|
|
49
|
-
{ $or: [{ organizationId: 'org-1' }, { organizationId: null }] },
|
|
50
|
-
])
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
expect(routing.get('priority')).toBe(PERSON_ENTITY_ID)
|
|
54
|
-
expect(routing.get('notes')).toBe(PERSON_ENTITY_ID)
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
it('falls back to customer entity when scores are equal', async () => {
|
|
58
|
-
const find = jest.fn().mockResolvedValue([
|
|
59
|
-
{
|
|
60
|
-
id: 'def-1',
|
|
61
|
-
key: 'priority',
|
|
62
|
-
kind: 'dictionary',
|
|
63
|
-
configJson: { filterable: true, priority: 2 },
|
|
64
|
-
entityId: CUSTOMER_ENTITY_ID,
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
id: 'def-2',
|
|
68
|
-
key: 'priority',
|
|
69
|
-
kind: 'dictionary',
|
|
70
|
-
configJson: { filterable: true, priority: 2 },
|
|
71
|
-
entityId: PERSON_ENTITY_ID,
|
|
72
|
-
},
|
|
73
|
-
])
|
|
74
|
-
const em = { find } as unknown as Parameters<typeof resolvePersonCustomFieldRouting>[0]
|
|
75
|
-
const routing = await resolvePersonCustomFieldRouting(em, null, null)
|
|
76
|
-
expect(find).toHaveBeenCalledWith(CustomFieldDef, expect.any(Object))
|
|
77
|
-
const [, where] = find.mock.calls[0]
|
|
78
|
-
expect(where.$and).toEqual([{ tenantId: null }])
|
|
79
|
-
expect(routing.get('priority')).toBe(CUSTOMER_ENTITY_ID)
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
it('merges customer and profile custom field values correctly', () => {
|
|
83
|
-
const routing = new Map<string, string>([
|
|
84
|
-
['fieldA', PERSON_ENTITY_ID],
|
|
85
|
-
['fieldB', CUSTOMER_ENTITY_ID],
|
|
86
|
-
['fieldC', PERSON_ENTITY_ID],
|
|
87
|
-
])
|
|
88
|
-
const entityValues = {
|
|
89
|
-
cf_fieldB: 'entity-value',
|
|
90
|
-
cf_fieldC: 'old-value',
|
|
91
|
-
}
|
|
92
|
-
const profileValues = {
|
|
93
|
-
cf_fieldA: 'profile-A',
|
|
94
|
-
fieldB: 'profile-should-not-overwrite',
|
|
95
|
-
cf_fieldC: 'profile-C',
|
|
96
|
-
cf_fieldD: 'profile-D',
|
|
97
|
-
}
|
|
98
|
-
const merged = mergePersonCustomFieldValues(routing, entityValues, profileValues)
|
|
99
|
-
expect(merged).toEqual({
|
|
100
|
-
cf_fieldB: 'entity-value',
|
|
101
|
-
cf_fieldC: 'profile-C',
|
|
102
|
-
cf_fieldA: 'profile-A',
|
|
103
|
-
cf_fieldD: 'profile-D',
|
|
104
|
-
fieldB: 'profile-should-not-overwrite',
|
|
105
|
-
})
|
|
106
|
-
})
|
|
107
|
-
})
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
formatAddressJson,
|
|
3
|
-
formatAddressLines,
|
|
4
|
-
formatAddressString,
|
|
5
|
-
} from '../addressFormat'
|
|
6
|
-
|
|
7
|
-
describe('customers utils - address formatting', () => {
|
|
8
|
-
it('normalizes address fields to trimmed values or null', () => {
|
|
9
|
-
const json = formatAddressJson(
|
|
10
|
-
{
|
|
11
|
-
addressLine1: ' 123 Baker Street ',
|
|
12
|
-
addressLine2: ' Suite 5 ',
|
|
13
|
-
buildingNumber: ' 10 ',
|
|
14
|
-
flatNumber: ' 2B ',
|
|
15
|
-
postalCode: ' NW1 ',
|
|
16
|
-
city: ' London ',
|
|
17
|
-
region: ' Greater London ',
|
|
18
|
-
country: ' UK ',
|
|
19
|
-
companyName: ' Widgets Inc. ',
|
|
20
|
-
},
|
|
21
|
-
'street_first'
|
|
22
|
-
)
|
|
23
|
-
expect(json).toEqual({
|
|
24
|
-
format: 'street_first',
|
|
25
|
-
companyName: 'Widgets Inc.',
|
|
26
|
-
addressLine1: '123 Baker Street',
|
|
27
|
-
addressLine2: 'Suite 5',
|
|
28
|
-
buildingNumber: '10',
|
|
29
|
-
flatNumber: '2B',
|
|
30
|
-
postalCode: 'NW1',
|
|
31
|
-
city: 'London',
|
|
32
|
-
region: 'Greater London',
|
|
33
|
-
country: 'UK',
|
|
34
|
-
})
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
it('formats lines in street_first mode with merged street data', () => {
|
|
38
|
-
const lines = formatAddressLines(
|
|
39
|
-
{
|
|
40
|
-
addressLine1: 'Baker Street',
|
|
41
|
-
addressLine2: 'Suite 5',
|
|
42
|
-
buildingNumber: '10',
|
|
43
|
-
flatNumber: '2B',
|
|
44
|
-
postalCode: 'NW1',
|
|
45
|
-
city: 'London',
|
|
46
|
-
region: 'Greater London',
|
|
47
|
-
country: 'UK',
|
|
48
|
-
},
|
|
49
|
-
'street_first'
|
|
50
|
-
)
|
|
51
|
-
expect(lines).toEqual([
|
|
52
|
-
'Baker Street 10/2B',
|
|
53
|
-
'Suite 5',
|
|
54
|
-
'NW1 London',
|
|
55
|
-
'Greater London',
|
|
56
|
-
'UK',
|
|
57
|
-
])
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
it('adds company name as the first line when present', () => {
|
|
61
|
-
const lines = formatAddressLines(
|
|
62
|
-
{
|
|
63
|
-
companyName: 'Widgets Inc.',
|
|
64
|
-
addressLine1: 'Baker Street',
|
|
65
|
-
buildingNumber: '10',
|
|
66
|
-
postalCode: 'NW1',
|
|
67
|
-
city: 'London',
|
|
68
|
-
},
|
|
69
|
-
'street_first'
|
|
70
|
-
)
|
|
71
|
-
expect(lines[0]).toBe('Widgets Inc.')
|
|
72
|
-
expect(lines.slice(1)).toEqual(['Baker Street 10', 'NW1 London'])
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
it('formats lines in line_first mode preserving primary line', () => {
|
|
76
|
-
const lines = formatAddressLines(
|
|
77
|
-
{
|
|
78
|
-
addressLine1: 'Headquarters',
|
|
79
|
-
addressLine2: 'North Entrance',
|
|
80
|
-
buildingNumber: '10',
|
|
81
|
-
postalCode: 'NW1',
|
|
82
|
-
city: 'London',
|
|
83
|
-
country: 'UK',
|
|
84
|
-
},
|
|
85
|
-
'line_first'
|
|
86
|
-
)
|
|
87
|
-
expect(lines).toEqual([
|
|
88
|
-
'Headquarters 10',
|
|
89
|
-
'North Entrance',
|
|
90
|
-
'NW1 London',
|
|
91
|
-
'UK',
|
|
92
|
-
])
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
it('joins formatted lines into a single string', () => {
|
|
96
|
-
const address = {
|
|
97
|
-
addressLine1: 'Baker Street',
|
|
98
|
-
buildingNumber: '10',
|
|
99
|
-
postalCode: 'NW1',
|
|
100
|
-
city: 'London',
|
|
101
|
-
}
|
|
102
|
-
expect(formatAddressString(address, 'street_first')).toBe('Baker Street 10, NW1 London')
|
|
103
|
-
expect(formatAddressString(address, 'line_first', ' | ')).toBe('Baker Street 10 | NW1 London')
|
|
104
|
-
})
|
|
105
|
-
})
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
jest.mock('@open-mercato/ui/backend/utils/apiCall', () => ({
|
|
2
|
-
apiCall: jest.fn(),
|
|
3
|
-
}))
|
|
4
|
-
|
|
5
|
-
import { lookupPhoneDuplicate } from '../phoneDuplicates'
|
|
6
|
-
import { apiCall } from '@open-mercato/ui/backend/utils/apiCall'
|
|
7
|
-
|
|
8
|
-
const mockedApiCall = apiCall as jest.MockedFunction<typeof apiCall>
|
|
9
|
-
|
|
10
|
-
const createResponse = (payload: unknown, ok = true) => {
|
|
11
|
-
return {
|
|
12
|
-
ok,
|
|
13
|
-
status: ok ? 200 : 500,
|
|
14
|
-
result: payload,
|
|
15
|
-
response: {} as Response,
|
|
16
|
-
cacheStatus: null,
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
describe('customers utils - phone duplicate lookup', () => {
|
|
21
|
-
beforeEach(() => {
|
|
22
|
-
mockedApiCall.mockReset()
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
it('returns null when no digits are provided', async () => {
|
|
26
|
-
const result = await lookupPhoneDuplicate(' ( ) ')
|
|
27
|
-
expect(result).toBeNull()
|
|
28
|
-
expect(mockedApiCall).not.toHaveBeenCalled()
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
it('returns first matching duplicate and builds link', async () => {
|
|
32
|
-
mockedApiCall.mockResolvedValueOnce(
|
|
33
|
-
createResponse({
|
|
34
|
-
items: [
|
|
35
|
-
{ id: 'c1', display_name: 'Ada Lovelace', primary_phone: '+1 (555) 123-4567' },
|
|
36
|
-
],
|
|
37
|
-
total: 1,
|
|
38
|
-
})
|
|
39
|
-
)
|
|
40
|
-
const result = await lookupPhoneDuplicate('+1 555 123-4567')
|
|
41
|
-
expect(result).toEqual({
|
|
42
|
-
id: 'c1',
|
|
43
|
-
label: 'Ada Lovelace',
|
|
44
|
-
href: '/backend/customers/people/c1',
|
|
45
|
-
})
|
|
46
|
-
expect(mockedApiCall).toHaveBeenCalledWith(
|
|
47
|
-
'/api/customers/people?hasPhone=true&page=1&pageSize=50&sortField=createdAt&sortDir=desc'
|
|
48
|
-
)
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
it('skips current record and continues scanning subsequent pages', async () => {
|
|
52
|
-
mockedApiCall
|
|
53
|
-
.mockResolvedValueOnce(
|
|
54
|
-
createResponse({
|
|
55
|
-
items: [
|
|
56
|
-
{ id: 'current', display_name: 'Keep', primary_phone: '+1 555 123-4567' },
|
|
57
|
-
],
|
|
58
|
-
total: 120,
|
|
59
|
-
})
|
|
60
|
-
)
|
|
61
|
-
.mockResolvedValueOnce(
|
|
62
|
-
createResponse({
|
|
63
|
-
items: [
|
|
64
|
-
{ id: 'duplicate', display_name: 'Grace Hopper', primary_phone: '+1 555 123-4567' },
|
|
65
|
-
],
|
|
66
|
-
total: 120,
|
|
67
|
-
})
|
|
68
|
-
)
|
|
69
|
-
.mockResolvedValue(createResponse({ items: [], total: 120 }))
|
|
70
|
-
|
|
71
|
-
const result = await lookupPhoneDuplicate('+1 555 123-4567', { recordId: 'current' })
|
|
72
|
-
expect(result).toEqual({
|
|
73
|
-
id: 'duplicate',
|
|
74
|
-
label: 'Grace Hopper',
|
|
75
|
-
href: '/backend/customers/people/duplicate',
|
|
76
|
-
})
|
|
77
|
-
expect(mockedApiCall).toHaveBeenCalledTimes(2)
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
it('ignores failed requests and returns null when nothing matches', async () => {
|
|
81
|
-
mockedApiCall
|
|
82
|
-
.mockRejectedValueOnce(new Error('network'))
|
|
83
|
-
.mockResolvedValueOnce(
|
|
84
|
-
createResponse({
|
|
85
|
-
items: [
|
|
86
|
-
{ id: 'c1', display_name: 'Incomplete', primary_phone: '+1 555 000-0000' },
|
|
87
|
-
{ id: 'c2', display_name: null, primary_phone: '+1 555 123-4567' },
|
|
88
|
-
],
|
|
89
|
-
total: 200,
|
|
90
|
-
})
|
|
91
|
-
)
|
|
92
|
-
.mockResolvedValue(createResponse({ items: [], total: 200 }))
|
|
93
|
-
|
|
94
|
-
const result = await lookupPhoneDuplicate('+1 555 999-9999')
|
|
95
|
-
expect(result).toBeNull()
|
|
96
|
-
expect(mockedApiCall).toHaveBeenCalledTimes(3)
|
|
97
|
-
})
|
|
98
|
-
})
|