@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,172 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jest-environment jsdom
|
|
3
|
-
*/
|
|
4
|
-
import type React from 'react'
|
|
5
|
-
import { render, screen, waitFor, fireEvent } from '@testing-library/react'
|
|
6
|
-
import ProductsDataTable from '../../../../components/products/ProductsDataTable'
|
|
7
|
-
import { apiCall, readApiResultOrThrow } from '@open-mercato/ui/backend/utils/apiCall'
|
|
8
|
-
import { deleteCrud, buildCrudExportUrl } from '@open-mercato/ui/backend/utils/crud'
|
|
9
|
-
import { flash } from '@open-mercato/ui/backend/FlashMessages'
|
|
10
|
-
import { useCustomFieldDefs } from '@open-mercato/ui/backend/utils/customFieldDefs'
|
|
11
|
-
import { applyCustomFieldVisibility } from '@open-mercato/ui/backend/utils/customFieldColumns'
|
|
12
|
-
import { useOrganizationScopeVersion } from '@open-mercato/shared/lib/frontend/useOrganizationScope'
|
|
13
|
-
|
|
14
|
-
const mockTranslate = (key: string, fallback?: string) => fallback ?? key
|
|
15
|
-
|
|
16
|
-
jest.mock('@open-mercato/shared/lib/i18n/context', () => ({
|
|
17
|
-
I18nProvider: ({ children }: { children: React.ReactNode }) => <>{children}</>,
|
|
18
|
-
}))
|
|
19
|
-
|
|
20
|
-
jest.mock('next/link', () => ({ children, href }: any) => <a href={href}>{children}</a>)
|
|
21
|
-
|
|
22
|
-
jest.mock('@open-mercato/ui/backend/DataTable', () => ({
|
|
23
|
-
DataTable: (props: any) => (
|
|
24
|
-
<div data-testid="data-table-mock">
|
|
25
|
-
<div data-testid="data-table-title">{props.title}</div>
|
|
26
|
-
<button data-testid="search-trigger" onClick={() => props.onSearchChange?.('widgets')}>
|
|
27
|
-
trigger-search
|
|
28
|
-
</button>
|
|
29
|
-
<div data-testid="row-actions-wrapper">
|
|
30
|
-
{props.rowActions?.({ id: 'prod-1', original: { id: 'prod-1', title: 'Mock product' } })}
|
|
31
|
-
</div>
|
|
32
|
-
{props.refreshButton ? (
|
|
33
|
-
<button data-testid="refresh-button" onClick={() => props.refreshButton.onRefresh?.()}>
|
|
34
|
-
{props.refreshButton.label}
|
|
35
|
-
</button>
|
|
36
|
-
) : null}
|
|
37
|
-
{props.actions}
|
|
38
|
-
</div>
|
|
39
|
-
),
|
|
40
|
-
}))
|
|
41
|
-
|
|
42
|
-
jest.mock('@open-mercato/ui/primitives/button', () => ({
|
|
43
|
-
Button: ({ children, asChild, ...rest }: any) =>
|
|
44
|
-
asChild ? <span {...rest}>{children}</span> : <button {...rest}>{children}</button>,
|
|
45
|
-
}))
|
|
46
|
-
|
|
47
|
-
jest.mock('@open-mercato/ui/backend/RowActions', () => ({
|
|
48
|
-
RowActions: ({ items }: any) => (
|
|
49
|
-
<div>
|
|
50
|
-
{items.map((item: any, idx: number) => (
|
|
51
|
-
<button key={item.label} data-testid={`row-action-${idx}`} onClick={() => item.onSelect?.()}>
|
|
52
|
-
{item.label}
|
|
53
|
-
</button>
|
|
54
|
-
))}
|
|
55
|
-
</div>
|
|
56
|
-
),
|
|
57
|
-
}))
|
|
58
|
-
|
|
59
|
-
jest.mock('@open-mercato/ui/backend/utils/apiCall', () => ({
|
|
60
|
-
apiCall: jest.fn(),
|
|
61
|
-
readApiResultOrThrow: jest.fn(),
|
|
62
|
-
}))
|
|
63
|
-
|
|
64
|
-
jest.mock('@open-mercato/ui/backend/FlashMessages', () => ({
|
|
65
|
-
flash: jest.fn(),
|
|
66
|
-
}))
|
|
67
|
-
|
|
68
|
-
jest.mock('@open-mercato/ui/backend/utils/crud', () => ({
|
|
69
|
-
deleteCrud: jest.fn(),
|
|
70
|
-
buildCrudExportUrl: jest.fn(),
|
|
71
|
-
}))
|
|
72
|
-
|
|
73
|
-
jest.mock('@open-mercato/ui/backend/utils/customFieldDefs', () => ({
|
|
74
|
-
useCustomFieldDefs: jest.fn(),
|
|
75
|
-
}))
|
|
76
|
-
|
|
77
|
-
jest.mock('@open-mercato/ui/backend/utils/customFieldColumns', () => ({
|
|
78
|
-
applyCustomFieldVisibility: jest.fn((cols) => cols),
|
|
79
|
-
}))
|
|
80
|
-
|
|
81
|
-
jest.mock('@open-mercato/ui/backend/ValueIcons', () => ({
|
|
82
|
-
BooleanIcon: ({ value }: { value: boolean }) => (
|
|
83
|
-
<span data-testid="boolean-icon">{String(value)}</span>
|
|
84
|
-
),
|
|
85
|
-
}))
|
|
86
|
-
|
|
87
|
-
jest.mock('@open-mercato/shared/lib/frontend/useOrganizationScope', () => ({
|
|
88
|
-
useOrganizationScopeVersion: jest.fn(),
|
|
89
|
-
}))
|
|
90
|
-
|
|
91
|
-
jest.mock('@open-mercato/shared/lib/i18n/context', () => ({
|
|
92
|
-
useT: () => mockTranslate,
|
|
93
|
-
}))
|
|
94
|
-
|
|
95
|
-
jest.mock('lucide-react', () => ({
|
|
96
|
-
RefreshCw: () => null,
|
|
97
|
-
}))
|
|
98
|
-
|
|
99
|
-
jest.mock('@open-mercato/ui/backend/confirm-dialog', () => ({
|
|
100
|
-
useConfirmDialog: () => ({
|
|
101
|
-
confirm: jest.fn(() => {
|
|
102
|
-
return new Promise<boolean>((resolve) => {
|
|
103
|
-
// Auto-confirm after a tick
|
|
104
|
-
setTimeout(() => resolve(true), 0)
|
|
105
|
-
})
|
|
106
|
-
}),
|
|
107
|
-
ConfirmDialogElement: null,
|
|
108
|
-
}),
|
|
109
|
-
}))
|
|
110
|
-
|
|
111
|
-
// Mock HTMLDialogElement methods for jsdom compatibility
|
|
112
|
-
HTMLDialogElement.prototype.showModal = jest.fn(function(this: HTMLDialogElement) {
|
|
113
|
-
this.open = true
|
|
114
|
-
this.setAttribute('open', '')
|
|
115
|
-
})
|
|
116
|
-
HTMLDialogElement.prototype.close = jest.fn(function(this: HTMLDialogElement) {
|
|
117
|
-
this.open = false
|
|
118
|
-
this.removeAttribute('open')
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
describe('ProductsDataTable', () => {
|
|
122
|
-
beforeEach(() => {
|
|
123
|
-
jest.clearAllMocks()
|
|
124
|
-
;(apiCall as jest.Mock).mockResolvedValue({
|
|
125
|
-
ok: true,
|
|
126
|
-
result: {
|
|
127
|
-
items: [{ id: 'prod-1', title: 'Mock product', sku: 'SKU-001' }],
|
|
128
|
-
total: 1,
|
|
129
|
-
totalPages: 1,
|
|
130
|
-
},
|
|
131
|
-
})
|
|
132
|
-
;(readApiResultOrThrow as jest.Mock).mockResolvedValue({ items: [{ id: 'channel-1', name: 'Retail' }] })
|
|
133
|
-
;(deleteCrud as jest.Mock).mockResolvedValue(undefined)
|
|
134
|
-
;(buildCrudExportUrl as jest.Mock).mockImplementation((_path: string, params: Record<string, string>) =>
|
|
135
|
-
`export?${new URLSearchParams(params).toString()}`,
|
|
136
|
-
)
|
|
137
|
-
;(useCustomFieldDefs as jest.Mock).mockReturnValue({ data: [], isLoading: false })
|
|
138
|
-
;(applyCustomFieldVisibility as jest.Mock).mockImplementation((cols) => cols)
|
|
139
|
-
;(useOrganizationScopeVersion as jest.Mock).mockReturnValue(1)
|
|
140
|
-
})
|
|
141
|
-
|
|
142
|
-
it('renders table title and loads catalog data', async () => {
|
|
143
|
-
render(<ProductsDataTable />)
|
|
144
|
-
|
|
145
|
-
await waitFor(() => expect(apiCall).toHaveBeenCalled())
|
|
146
|
-
expect(screen.getByTestId('data-table-title')).toHaveTextContent('Products & services')
|
|
147
|
-
expect((apiCall as jest.Mock).mock.calls[0][0]).toContain('/api/catalog/products?page=1&pageSize=25')
|
|
148
|
-
expect(applyCustomFieldVisibility).toHaveBeenCalled()
|
|
149
|
-
})
|
|
150
|
-
|
|
151
|
-
it('handles row deletion flow with confirmation', async () => {
|
|
152
|
-
render(<ProductsDataTable />)
|
|
153
|
-
await waitFor(() => expect(apiCall).toHaveBeenCalled())
|
|
154
|
-
|
|
155
|
-
const deleteButton = await screen.findByTestId('row-action-1')
|
|
156
|
-
fireEvent.click(deleteButton)
|
|
157
|
-
|
|
158
|
-
// Wait for delete to complete (mock auto-confirms)
|
|
159
|
-
await waitFor(() => expect(deleteCrud).toHaveBeenCalledWith('catalog/products', 'prod-1', expect.any(Object)))
|
|
160
|
-
expect(flash).toHaveBeenCalledWith(expect.stringContaining('Product deleted'), 'success')
|
|
161
|
-
})
|
|
162
|
-
|
|
163
|
-
it('refreshes data when refresh button is clicked', async () => {
|
|
164
|
-
render(<ProductsDataTable />)
|
|
165
|
-
await waitFor(() => expect(apiCall).toHaveBeenCalledTimes(1))
|
|
166
|
-
|
|
167
|
-
const refreshButton = screen.getByText('Refresh')
|
|
168
|
-
fireEvent.click(refreshButton)
|
|
169
|
-
|
|
170
|
-
await waitFor(() => expect(apiCall).toHaveBeenCalledTimes(2))
|
|
171
|
-
})
|
|
172
|
-
})
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
export {}
|
|
2
|
-
|
|
3
|
-
import { CatalogOffer, CatalogProductVariant } from '../../data/entities'
|
|
4
|
-
import { E } from '#generated/entities.ids.generated'
|
|
5
|
-
|
|
6
|
-
const registerCommand = jest.fn()
|
|
7
|
-
const emitCatalogQueryIndexEvent = jest.fn().mockResolvedValue(undefined)
|
|
8
|
-
const setCustomFieldsIfAny = jest.fn().mockResolvedValue(undefined)
|
|
9
|
-
const loadCustomFieldSnapshot = jest.fn().mockResolvedValue({})
|
|
10
|
-
|
|
11
|
-
jest.mock('@open-mercato/shared/lib/commands', () => ({
|
|
12
|
-
registerCommand,
|
|
13
|
-
}))
|
|
14
|
-
|
|
15
|
-
jest.mock('@open-mercato/shared/lib/i18n/server', () => ({
|
|
16
|
-
resolveTranslations: jest.fn().mockResolvedValue({
|
|
17
|
-
translate: (_key: string, fallback?: string) => fallback ?? _key,
|
|
18
|
-
}),
|
|
19
|
-
}))
|
|
20
|
-
|
|
21
|
-
jest.mock('@open-mercato/shared/lib/commands/helpers', () => {
|
|
22
|
-
const actual = jest.requireActual('@open-mercato/shared/lib/commands/helpers')
|
|
23
|
-
return {
|
|
24
|
-
...actual,
|
|
25
|
-
setCustomFieldsIfAny,
|
|
26
|
-
}
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
jest.mock('@open-mercato/shared/lib/commands/customFieldSnapshots', () => {
|
|
30
|
-
const actual = jest.requireActual('@open-mercato/shared/lib/commands/customFieldSnapshots')
|
|
31
|
-
return {
|
|
32
|
-
...actual,
|
|
33
|
-
loadCustomFieldSnapshot,
|
|
34
|
-
}
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
jest.mock('../shared', () => {
|
|
38
|
-
const actual = jest.requireActual('../shared')
|
|
39
|
-
return {
|
|
40
|
-
...actual,
|
|
41
|
-
emitCatalogQueryIndexEvent,
|
|
42
|
-
}
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
describe('catalog.products.delete', () => {
|
|
46
|
-
beforeEach(() => {
|
|
47
|
-
jest.clearAllMocks()
|
|
48
|
-
jest.resetModules()
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
it('emits reindex events for variants when a product is deleted', async () => {
|
|
52
|
-
let deleteCommand: any
|
|
53
|
-
jest.isolateModules(() => {
|
|
54
|
-
require('../products')
|
|
55
|
-
deleteCommand = registerCommand.mock.calls.find(([cmd]) => cmd.id === 'catalog.products.delete')?.[0]
|
|
56
|
-
})
|
|
57
|
-
expect(deleteCommand).toBeDefined()
|
|
58
|
-
|
|
59
|
-
const variants = [
|
|
60
|
-
{ id: 'variant-1', organizationId: 'org-1', tenantId: 'tenant-1' },
|
|
61
|
-
{ id: 'variant-2', organizationId: 'org-1', tenantId: 'tenant-1' },
|
|
62
|
-
]
|
|
63
|
-
const now = new Date()
|
|
64
|
-
const em = {
|
|
65
|
-
findOne: jest.fn().mockResolvedValue({
|
|
66
|
-
id: 'prod-1',
|
|
67
|
-
organizationId: 'org-1',
|
|
68
|
-
tenantId: 'tenant-1',
|
|
69
|
-
title: 'Test product',
|
|
70
|
-
subtitle: null,
|
|
71
|
-
description: null,
|
|
72
|
-
sku: null,
|
|
73
|
-
handle: null,
|
|
74
|
-
taxRateId: null,
|
|
75
|
-
taxRate: null,
|
|
76
|
-
productType: 'standard',
|
|
77
|
-
statusEntryId: null,
|
|
78
|
-
primaryCurrencyCode: null,
|
|
79
|
-
defaultUnit: null,
|
|
80
|
-
defaultMediaId: null,
|
|
81
|
-
defaultMediaUrl: null,
|
|
82
|
-
weightValue: null,
|
|
83
|
-
weightUnit: null,
|
|
84
|
-
dimensions: null,
|
|
85
|
-
metadata: null,
|
|
86
|
-
isConfigurable: false,
|
|
87
|
-
isActive: true,
|
|
88
|
-
optionSchemaTemplate: null,
|
|
89
|
-
customFieldsetCode: null,
|
|
90
|
-
createdAt: now,
|
|
91
|
-
updatedAt: now,
|
|
92
|
-
}),
|
|
93
|
-
find: jest.fn().mockImplementation((entity) => {
|
|
94
|
-
const name = typeof entity === 'function' ? entity.name : ''
|
|
95
|
-
if (name === CatalogProductVariant.name) return Promise.resolve(variants)
|
|
96
|
-
if (name === CatalogOffer.name) return Promise.resolve([])
|
|
97
|
-
return Promise.resolve([])
|
|
98
|
-
}),
|
|
99
|
-
nativeDelete: jest.fn().mockResolvedValue(undefined),
|
|
100
|
-
remove: jest.fn(),
|
|
101
|
-
flush: jest.fn().mockResolvedValue(undefined),
|
|
102
|
-
fork: jest.fn(),
|
|
103
|
-
count: jest.fn().mockResolvedValue(0),
|
|
104
|
-
}
|
|
105
|
-
em.fork.mockReturnValue(em)
|
|
106
|
-
|
|
107
|
-
const dataEngine = {
|
|
108
|
-
markOrmEntityChange: jest.fn(),
|
|
109
|
-
}
|
|
110
|
-
const container = {
|
|
111
|
-
resolve: jest.fn((token: string) => {
|
|
112
|
-
if (token === 'em') return em
|
|
113
|
-
if (token === 'dataEngine') return dataEngine
|
|
114
|
-
return undefined
|
|
115
|
-
}),
|
|
116
|
-
}
|
|
117
|
-
const ctx = {
|
|
118
|
-
container,
|
|
119
|
-
auth: { sub: 'user-1', tenantId: 'tenant-1', orgId: 'org-1' },
|
|
120
|
-
organizationScope: null,
|
|
121
|
-
selectedOrganizationId: null,
|
|
122
|
-
organizationIds: null,
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
await deleteCommand.execute({ id: 'prod-1' }, ctx)
|
|
126
|
-
|
|
127
|
-
expect(emitCatalogQueryIndexEvent).toHaveBeenCalledTimes(variants.length)
|
|
128
|
-
const payloads = emitCatalogQueryIndexEvent.mock.calls.map(([, payload]) => payload)
|
|
129
|
-
expect(payloads).toEqual([
|
|
130
|
-
expect.objectContaining({
|
|
131
|
-
entityType: E.catalog.catalog_product_variant,
|
|
132
|
-
recordId: 'variant-1',
|
|
133
|
-
organizationId: 'org-1',
|
|
134
|
-
tenantId: 'tenant-1',
|
|
135
|
-
action: 'deleted',
|
|
136
|
-
}),
|
|
137
|
-
expect.objectContaining({
|
|
138
|
-
entityType: E.catalog.catalog_product_variant,
|
|
139
|
-
recordId: 'variant-2',
|
|
140
|
-
organizationId: 'org-1',
|
|
141
|
-
tenantId: 'tenant-1',
|
|
142
|
-
action: 'deleted',
|
|
143
|
-
}),
|
|
144
|
-
])
|
|
145
|
-
})
|
|
146
|
-
})
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
export {}
|
|
2
|
-
|
|
3
|
-
import { CatalogOffer, CatalogProductCategoryAssignment } from '../../data/entities'
|
|
4
|
-
|
|
5
|
-
const registerCommand = jest.fn()
|
|
6
|
-
const findWithDecryption = jest.fn().mockImplementation(async (...args: unknown[]) => {
|
|
7
|
-
const ctx = (findWithDecryption as any).__ctx as { events: string[] } | undefined
|
|
8
|
-
ctx?.events.push('findWithDecryption')
|
|
9
|
-
return []
|
|
10
|
-
})
|
|
11
|
-
const findOneWithDecryption = jest.fn().mockResolvedValue(null)
|
|
12
|
-
|
|
13
|
-
jest.mock('@open-mercato/shared/lib/commands', () => ({
|
|
14
|
-
registerCommand,
|
|
15
|
-
}))
|
|
16
|
-
|
|
17
|
-
jest.mock('@open-mercato/shared/lib/encryption/find', () => ({
|
|
18
|
-
findWithDecryption: (...args: unknown[]) => findWithDecryption(...args),
|
|
19
|
-
findOneWithDecryption: (...args: unknown[]) => findOneWithDecryption(...args),
|
|
20
|
-
}))
|
|
21
|
-
|
|
22
|
-
jest.mock('@open-mercato/shared/lib/i18n/server', () => ({
|
|
23
|
-
resolveTranslations: jest.fn().mockResolvedValue({
|
|
24
|
-
translate: (_key: string, fallback?: string) => fallback ?? _key,
|
|
25
|
-
}),
|
|
26
|
-
}))
|
|
27
|
-
|
|
28
|
-
describe('catalog.products.update', () => {
|
|
29
|
-
beforeEach(() => {
|
|
30
|
-
jest.clearAllMocks()
|
|
31
|
-
jest.resetModules()
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
it('flushes product changes before syncing offers/categories/tags', async () => {
|
|
35
|
-
let updateCommand: any
|
|
36
|
-
jest.isolateModules(() => {
|
|
37
|
-
require('../products')
|
|
38
|
-
updateCommand = registerCommand.mock.calls.find(([cmd]) => cmd.id === 'catalog.products.update')?.[0]
|
|
39
|
-
})
|
|
40
|
-
expect(updateCommand).toBeDefined()
|
|
41
|
-
|
|
42
|
-
const events: string[] = []
|
|
43
|
-
;(findWithDecryption as any).__ctx = { events }
|
|
44
|
-
|
|
45
|
-
const record = {
|
|
46
|
-
id: '11111111-1111-4111-8111-111111111111',
|
|
47
|
-
organizationId: '22222222-2222-4222-8222-222222222222',
|
|
48
|
-
tenantId: '33333333-3333-4333-8333-333333333333',
|
|
49
|
-
title: 'Old title',
|
|
50
|
-
subtitle: null,
|
|
51
|
-
description: null,
|
|
52
|
-
sku: null,
|
|
53
|
-
handle: null,
|
|
54
|
-
taxRateId: null,
|
|
55
|
-
taxRate: null,
|
|
56
|
-
productType: 'simple',
|
|
57
|
-
statusEntryId: null,
|
|
58
|
-
primaryCurrencyCode: null,
|
|
59
|
-
defaultUnit: null,
|
|
60
|
-
defaultMediaId: null,
|
|
61
|
-
defaultMediaUrl: null,
|
|
62
|
-
weightValue: null,
|
|
63
|
-
weightUnit: null,
|
|
64
|
-
dimensions: null,
|
|
65
|
-
metadata: null,
|
|
66
|
-
customFieldsetCode: null,
|
|
67
|
-
optionSchemaTemplate: null,
|
|
68
|
-
isConfigurable: false,
|
|
69
|
-
isActive: true,
|
|
70
|
-
createdAt: new Date(),
|
|
71
|
-
updatedAt: new Date(),
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const em = {
|
|
75
|
-
findOne: jest.fn().mockImplementation(async () => {
|
|
76
|
-
events.push('findOne')
|
|
77
|
-
return record
|
|
78
|
-
}),
|
|
79
|
-
find: jest.fn().mockImplementation(async (entity: any) => {
|
|
80
|
-
const name = typeof entity === 'function' ? entity.name : String(entity)
|
|
81
|
-
events.push(`find:${name}`)
|
|
82
|
-
return []
|
|
83
|
-
}),
|
|
84
|
-
create: jest.fn().mockImplementation((_entity: any, payload: any) => payload),
|
|
85
|
-
remove: jest.fn(),
|
|
86
|
-
persist: jest.fn(),
|
|
87
|
-
flush: jest.fn().mockImplementation(async () => {
|
|
88
|
-
events.push('flush')
|
|
89
|
-
}),
|
|
90
|
-
fork: jest.fn(),
|
|
91
|
-
}
|
|
92
|
-
em.fork.mockReturnValue(em)
|
|
93
|
-
|
|
94
|
-
const dataEngine = {
|
|
95
|
-
markOrmEntityChange: jest.fn(),
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const container = {
|
|
99
|
-
resolve: jest.fn((token: string) => {
|
|
100
|
-
if (token === 'em') return em
|
|
101
|
-
if (token === 'dataEngine') return dataEngine
|
|
102
|
-
return undefined
|
|
103
|
-
}),
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const ctx = {
|
|
107
|
-
container,
|
|
108
|
-
auth: {
|
|
109
|
-
sub: 'user-1',
|
|
110
|
-
tenantId: '33333333-3333-4333-8333-333333333333',
|
|
111
|
-
orgId: '22222222-2222-4222-8222-222222222222',
|
|
112
|
-
},
|
|
113
|
-
organizationScope: null,
|
|
114
|
-
selectedOrganizationId: null,
|
|
115
|
-
organizationIds: null,
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
await updateCommand.execute(
|
|
119
|
-
{
|
|
120
|
-
id: '11111111-1111-4111-8111-111111111111',
|
|
121
|
-
organizationId: '22222222-2222-4222-8222-222222222222',
|
|
122
|
-
tenantId: '33333333-3333-4333-8333-333333333333',
|
|
123
|
-
title: 'New title',
|
|
124
|
-
offers: [],
|
|
125
|
-
categoryIds: [],
|
|
126
|
-
tags: [],
|
|
127
|
-
},
|
|
128
|
-
ctx
|
|
129
|
-
)
|
|
130
|
-
|
|
131
|
-
const firstFlush = events.indexOf('flush')
|
|
132
|
-
const firstFind = events.findIndex((entry) => entry.startsWith('find:'))
|
|
133
|
-
const firstFindWithDecryption = events.indexOf('findWithDecryption')
|
|
134
|
-
|
|
135
|
-
expect(firstFlush).toBeGreaterThan(-1)
|
|
136
|
-
expect(firstFind).toBeGreaterThan(-1)
|
|
137
|
-
expect(firstFlush).toBeLessThan(firstFind)
|
|
138
|
-
expect(firstFlush).toBeLessThan(firstFindWithDecryption)
|
|
139
|
-
expect(events).toContain(`find:${CatalogOffer.name}`)
|
|
140
|
-
expect(events).toContain(`find:${CatalogProductCategoryAssignment.name}`)
|
|
141
|
-
})
|
|
142
|
-
})
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
export {}
|
|
2
|
-
|
|
3
|
-
const registerCommand = jest.fn()
|
|
4
|
-
|
|
5
|
-
jest.mock('@open-mercato/shared/lib/commands', () => ({
|
|
6
|
-
registerCommand,
|
|
7
|
-
}))
|
|
8
|
-
|
|
9
|
-
jest.mock('@open-mercato/shared/lib/i18n/server', () => ({
|
|
10
|
-
resolveTranslations: jest.fn().mockResolvedValue({
|
|
11
|
-
translate: (_key: string, fallback?: string) => fallback ?? _key,
|
|
12
|
-
}),
|
|
13
|
-
}))
|
|
14
|
-
|
|
15
|
-
describe('catalog command registration', () => {
|
|
16
|
-
const cases = [
|
|
17
|
-
{
|
|
18
|
-
path: '../products',
|
|
19
|
-
expected: ['catalog.products.create', 'catalog.products.update', 'catalog.products.delete'],
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
path: '../variants',
|
|
23
|
-
expected: ['catalog.variants.create', 'catalog.variants.update', 'catalog.variants.delete'],
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
path: '../prices',
|
|
27
|
-
expected: ['catalog.prices.create', 'catalog.prices.update', 'catalog.prices.delete'],
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
path: '../priceKinds',
|
|
31
|
-
expected: ['catalog.priceKinds.create', 'catalog.priceKinds.update', 'catalog.priceKinds.delete'],
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
path: '../categories',
|
|
35
|
-
expected: ['catalog.categories.create', 'catalog.categories.update', 'catalog.categories.delete'],
|
|
36
|
-
},
|
|
37
|
-
]
|
|
38
|
-
|
|
39
|
-
beforeEach(() => {
|
|
40
|
-
registerCommand.mockClear()
|
|
41
|
-
jest.resetModules()
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
for (const testCase of cases) {
|
|
45
|
-
it(`registers commands for ${testCase.path}`, () => {
|
|
46
|
-
jest.isolateModules(() => {
|
|
47
|
-
require(testCase.path)
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
const ids = registerCommand.mock.calls.map(([cmd]) => cmd.id)
|
|
51
|
-
expect(ids).toEqual(testCase.expected)
|
|
52
|
-
})
|
|
53
|
-
}
|
|
54
|
-
})
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ensureTenantScope,
|
|
3
|
-
ensureOrganizationScope,
|
|
4
|
-
ensureSameScope,
|
|
5
|
-
assertFound,
|
|
6
|
-
extractUndoPayload,
|
|
7
|
-
cloneJson,
|
|
8
|
-
toNumericString,
|
|
9
|
-
requireProduct,
|
|
10
|
-
requireVariant,
|
|
11
|
-
requireOffer,
|
|
12
|
-
requireOptionSchemaTemplate,
|
|
13
|
-
} from '../shared'
|
|
14
|
-
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
15
|
-
import type { CommandRuntimeContext } from '@open-mercato/shared/lib/commands'
|
|
16
|
-
import type { AwilixContainer } from 'awilix'
|
|
17
|
-
|
|
18
|
-
describe('catalog command shared helpers', () => {
|
|
19
|
-
type AuthOverride = Partial<NonNullable<CommandRuntimeContext['auth']>> | null
|
|
20
|
-
const createCtx = (
|
|
21
|
-
overrides: Partial<Omit<CommandRuntimeContext, 'auth'>> & { auth?: AuthOverride } = {}
|
|
22
|
-
): CommandRuntimeContext => {
|
|
23
|
-
const baseAuth: NonNullable<CommandRuntimeContext['auth']> = {
|
|
24
|
-
sub: 'user-1',
|
|
25
|
-
tenantId: 'tenant-1',
|
|
26
|
-
orgId: 'org-1',
|
|
27
|
-
}
|
|
28
|
-
const { auth: authOverride, ...rest } = overrides
|
|
29
|
-
const auth =
|
|
30
|
-
authOverride === null
|
|
31
|
-
? null
|
|
32
|
-
: ({
|
|
33
|
-
...baseAuth,
|
|
34
|
-
...(authOverride ?? {}),
|
|
35
|
-
} as NonNullable<CommandRuntimeContext['auth']>)
|
|
36
|
-
return {
|
|
37
|
-
container: { resolve: jest.fn() } as unknown as AwilixContainer,
|
|
38
|
-
auth,
|
|
39
|
-
organizationScope: null,
|
|
40
|
-
selectedOrganizationId: null,
|
|
41
|
-
organizationIds: null,
|
|
42
|
-
...rest,
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
it('enforces tenant scope when conflicting tenant id is provided', () => {
|
|
47
|
-
expect(() => ensureTenantScope(createCtx(), 'tenant-1')).not.toThrow()
|
|
48
|
-
expect(() => ensureTenantScope(createCtx({ auth: { tenantId: null } }), 'tenant-2')).not.toThrow()
|
|
49
|
-
expect(() => ensureTenantScope(createCtx(), 'tenant-2')).toThrow(CrudHttpError)
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
it('enforces organization scope with either selected org or auth org id', () => {
|
|
53
|
-
expect(() => ensureOrganizationScope(createCtx(), 'org-1')).not.toThrow()
|
|
54
|
-
expect(() => ensureOrganizationScope(createCtx({ selectedOrganizationId: 'org-override' }), 'org-override')).not.toThrow()
|
|
55
|
-
expect(() => ensureOrganizationScope(createCtx(), 'org-2')).toThrow(CrudHttpError)
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
it('ensures entities belong to the same tenant + org combo', () => {
|
|
59
|
-
expect(() => ensureSameScope({ organizationId: 'org-1', tenantId: 'tenant-1' }, 'org-1', 'tenant-1')).not.toThrow()
|
|
60
|
-
expect(() => ensureSameScope({ organizationId: 'org-1', tenantId: 'tenant-2' }, 'org-1', 'tenant-1')).toThrow(CrudHttpError)
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
it('asserts non-null values', () => {
|
|
64
|
-
expect(assertFound(1, 'missing')).toBe(1)
|
|
65
|
-
expect(() => assertFound(null, 'missing')).toThrow(CrudHttpError)
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
it('extracts undo payloads regardless of nesting', () => {
|
|
69
|
-
const basePayload = { foo: 'bar' }
|
|
70
|
-
const direct = { commandPayload: { undo: basePayload } }
|
|
71
|
-
const nested = { commandPayload: { value: { undo: basePayload } } }
|
|
72
|
-
const deepNested = { commandPayload: { anything: { undo: basePayload }, __redoInput: {} } }
|
|
73
|
-
expect(extractUndoPayload(direct as any)).toEqual(basePayload)
|
|
74
|
-
expect(extractUndoPayload(nested as any)).toEqual(basePayload)
|
|
75
|
-
expect(extractUndoPayload(deepNested as any)).toEqual(basePayload)
|
|
76
|
-
expect(extractUndoPayload(null)).toBeNull()
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
it('clones JSON-compatible structures defensively', () => {
|
|
80
|
-
const payload = { nested: { value: 1 } }
|
|
81
|
-
const clone = cloneJson(payload)
|
|
82
|
-
expect(clone).toEqual(payload)
|
|
83
|
-
expect(clone).not.toBe(payload)
|
|
84
|
-
;(clone as any).nested.value = 2
|
|
85
|
-
expect(payload.nested.value).toBe(1)
|
|
86
|
-
})
|
|
87
|
-
|
|
88
|
-
it('normalizes numeric values to strings', () => {
|
|
89
|
-
expect(toNumericString(15)).toBe('15')
|
|
90
|
-
expect(toNumericString(null)).toBeNull()
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
const entityTests: Array<{
|
|
94
|
-
label: string
|
|
95
|
-
fn: (em: any) => Promise<any>
|
|
96
|
-
expectedArgs: any
|
|
97
|
-
}> = [
|
|
98
|
-
{ label: 'requireProduct', fn: (em) => requireProduct(em, 'prod'), expectedArgs: [{ id: 'prod', deletedAt: null }] },
|
|
99
|
-
{
|
|
100
|
-
label: 'requireVariant',
|
|
101
|
-
fn: (em) => requireVariant(em, 'variant'),
|
|
102
|
-
expectedArgs: [{ id: 'variant', deletedAt: null }, { populate: ['product'] }],
|
|
103
|
-
},
|
|
104
|
-
{ label: 'requireOffer', fn: (em) => requireOffer(em, 'offer'), expectedArgs: [{ id: 'offer' }] },
|
|
105
|
-
{
|
|
106
|
-
label: 'requireOptionSchemaTemplate',
|
|
107
|
-
fn: (em) => requireOptionSchemaTemplate(em, 'schema'),
|
|
108
|
-
expectedArgs: [{ id: 'schema', deletedAt: null }],
|
|
109
|
-
},
|
|
110
|
-
]
|
|
111
|
-
|
|
112
|
-
for (const { label, fn, expectedArgs } of entityTests) {
|
|
113
|
-
it(`${label} resolves entities or throws`, async () => {
|
|
114
|
-
const entity = { id: 'record' }
|
|
115
|
-
const findOne = jest.fn().mockResolvedValue(entity)
|
|
116
|
-
const em = { findOne }
|
|
117
|
-
|
|
118
|
-
await expect(fn(em)).resolves.toBe(entity)
|
|
119
|
-
if (expectedArgs[1]) {
|
|
120
|
-
expect(findOne).toHaveBeenCalledWith(expect.any(Function), expectedArgs[0], expectedArgs[1])
|
|
121
|
-
} else {
|
|
122
|
-
expect(findOne).toHaveBeenCalledWith(expect.any(Function), expectedArgs[0])
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
findOne.mockResolvedValue(null)
|
|
126
|
-
await expect(fn(em)).rejects.toBeInstanceOf(CrudHttpError)
|
|
127
|
-
})
|
|
128
|
-
}
|
|
129
|
-
})
|