@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,456 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jest-environment jsdom
|
|
3
|
-
*/
|
|
4
|
-
import * as React from 'react'
|
|
5
|
-
import { render, screen, fireEvent, waitFor } from '@testing-library/react'
|
|
6
|
-
import { PriceWithCurrency, formatPriceWithCurrency } from '../PriceWithCurrency'
|
|
7
|
-
import { DocumentCustomerCard } from '../DocumentCustomerCard'
|
|
8
|
-
import { DocumentTotals } from '../documents/DocumentTotals'
|
|
9
|
-
import { DocumentNumberSettings } from '../DocumentNumberSettings'
|
|
10
|
-
import { OrderEditingSettings } from '../OrderEditingSettings'
|
|
11
|
-
import { AdjustmentKindSettings } from '../AdjustmentKindSettings'
|
|
12
|
-
import { PaymentMethodsSettings } from '../PaymentMethodsSettings'
|
|
13
|
-
import { ShippingMethodsSettings } from '../ShippingMethodsSettings'
|
|
14
|
-
import { StatusSettings } from '../StatusSettings'
|
|
15
|
-
import { TaxRatesSettings } from '../TaxRatesSettings'
|
|
16
|
-
import { SalesChannelOffersPanel } from '../channels/SalesChannelOffersPanel'
|
|
17
|
-
import { ChannelOfferForm } from '../channels/ChannelOfferForm'
|
|
18
|
-
|
|
19
|
-
const mockApiCall = jest.fn()
|
|
20
|
-
const mockReadApiResultOrThrow = jest.fn()
|
|
21
|
-
const mockCreateCrud = jest.fn()
|
|
22
|
-
const mockUpdateCrud = jest.fn()
|
|
23
|
-
const mockDeleteCrud = jest.fn()
|
|
24
|
-
const mockFlash = jest.fn()
|
|
25
|
-
const mockCollectCustomFieldValues = jest.fn().mockReturnValue({})
|
|
26
|
-
|
|
27
|
-
jest.mock('@open-mercato/ui/backend/utils/apiCall', () => ({
|
|
28
|
-
apiCall: (...args: any[]) => mockApiCall(...args),
|
|
29
|
-
apiCallOrThrow: (...args: any[]) => mockReadApiResultOrThrow(...args),
|
|
30
|
-
readApiResultOrThrow: (...args: any[]) => mockReadApiResultOrThrow(...args),
|
|
31
|
-
}))
|
|
32
|
-
|
|
33
|
-
jest.mock('@open-mercato/ui/backend/utils/crud', () => ({
|
|
34
|
-
createCrud: (...args: any[]) => mockCreateCrud(...args),
|
|
35
|
-
updateCrud: (...args: any[]) => mockUpdateCrud(...args),
|
|
36
|
-
deleteCrud: (...args: any[]) => mockDeleteCrud(...args),
|
|
37
|
-
buildCrudExportUrl: () => '/export.csv',
|
|
38
|
-
}))
|
|
39
|
-
|
|
40
|
-
jest.mock('@open-mercato/ui/backend/FlashMessages', () => ({
|
|
41
|
-
flash: (...args: any[]) => mockFlash(...args),
|
|
42
|
-
}))
|
|
43
|
-
|
|
44
|
-
jest.mock('@open-mercato/ui/backend/CrudForm', () => ({
|
|
45
|
-
CrudForm: ({
|
|
46
|
-
children,
|
|
47
|
-
fields = [],
|
|
48
|
-
onSubmit,
|
|
49
|
-
submitLabel = 'Submit',
|
|
50
|
-
renderGroups,
|
|
51
|
-
groups = [],
|
|
52
|
-
}: any) => {
|
|
53
|
-
const renderedFields = renderGroups
|
|
54
|
-
? renderGroups({
|
|
55
|
-
groups,
|
|
56
|
-
fields,
|
|
57
|
-
renderField: (field: any) => (
|
|
58
|
-
<div key={field.id ?? field.name} data-testid={`crud-field-${field.name ?? field.id}`}>
|
|
59
|
-
{field.label ?? field.name}
|
|
60
|
-
</div>
|
|
61
|
-
),
|
|
62
|
-
})
|
|
63
|
-
: fields.map((field: any) => (
|
|
64
|
-
<div key={field.id ?? field.name} data-testid={`crud-field-${field.name ?? field.id}`}>
|
|
65
|
-
{field.label ?? field.name}
|
|
66
|
-
</div>
|
|
67
|
-
))
|
|
68
|
-
return (
|
|
69
|
-
<form
|
|
70
|
-
onSubmit={(event) => {
|
|
71
|
-
event.preventDefault()
|
|
72
|
-
onSubmit?.({})
|
|
73
|
-
}}
|
|
74
|
-
>
|
|
75
|
-
{renderedFields}
|
|
76
|
-
{children}
|
|
77
|
-
<button type="submit">{submitLabel}</button>
|
|
78
|
-
</form>
|
|
79
|
-
)
|
|
80
|
-
},
|
|
81
|
-
}))
|
|
82
|
-
|
|
83
|
-
jest.mock('@open-mercato/ui/backend/DataTable', () => ({
|
|
84
|
-
DataTable: ({ title, data = [], children }: any) => {
|
|
85
|
-
const key = typeof title === 'string' ? title.replace(/\\s+/g, '-').toLowerCase() : 'table'
|
|
86
|
-
return (
|
|
87
|
-
<div>
|
|
88
|
-
{title ? <h2>{title}</h2> : null}
|
|
89
|
-
<div data-testid={`data-table-count-${key}`}>{Array.isArray(data) ? data.length : 0}</div>
|
|
90
|
-
<div>{children}</div>
|
|
91
|
-
{Array.isArray(data)
|
|
92
|
-
? data.map((row, idx) => (
|
|
93
|
-
<div key={idx} data-testid="data-row">
|
|
94
|
-
{row.title ?? row.label ?? row.name ?? row.code ?? row.value ?? row.id}
|
|
95
|
-
</div>
|
|
96
|
-
))
|
|
97
|
-
: null}
|
|
98
|
-
</div>
|
|
99
|
-
)
|
|
100
|
-
},
|
|
101
|
-
}))
|
|
102
|
-
|
|
103
|
-
jest.mock('@open-mercato/ui/backend/RowActions', () => ({
|
|
104
|
-
RowActions: ({ children }: { children?: React.ReactNode }) => <div>{children}</div>,
|
|
105
|
-
}))
|
|
106
|
-
|
|
107
|
-
jest.mock('@open-mercato/ui/backend/ValueIcons', () => ({
|
|
108
|
-
BooleanIcon: ({ value }: { value?: boolean }) => <span>{value ? 'Yes' : 'No'}</span>,
|
|
109
|
-
}))
|
|
110
|
-
|
|
111
|
-
jest.mock('@open-mercato/ui/backend/detail', () => ({
|
|
112
|
-
LoadingMessage: ({ label }: { label: string }) => <div>{label}</div>,
|
|
113
|
-
ErrorMessage: ({ label }: { label: string }) => <div>{label}</div>,
|
|
114
|
-
TabEmptyState: ({ title, action }: any) => (
|
|
115
|
-
<div>
|
|
116
|
-
<div>{title}</div>
|
|
117
|
-
{action ? <button onClick={action.onClick}>{action.label}</button> : null}
|
|
118
|
-
</div>
|
|
119
|
-
),
|
|
120
|
-
}))
|
|
121
|
-
|
|
122
|
-
jest.mock('@open-mercato/ui/backend/inputs', () => ({
|
|
123
|
-
LookupSelect: ({ value, onChange, options = [] }: any) => (
|
|
124
|
-
<select value={value ?? ''} onChange={(event) => onChange?.(event.target.value || null)}>
|
|
125
|
-
<option value="">Select</option>
|
|
126
|
-
{options.map((opt: any) => (
|
|
127
|
-
<option key={opt.value} value={opt.value}>
|
|
128
|
-
{opt.label}
|
|
129
|
-
</option>
|
|
130
|
-
))}
|
|
131
|
-
</select>
|
|
132
|
-
),
|
|
133
|
-
}))
|
|
134
|
-
|
|
135
|
-
jest.mock('@open-mercato/ui/backend/utils/customFieldValues', () => ({
|
|
136
|
-
collectCustomFieldValues: (...args: any[]) => mockCollectCustomFieldValues(...args),
|
|
137
|
-
}))
|
|
138
|
-
|
|
139
|
-
jest.mock('@open-mercato/ui/backend/utils/serverErrors', () => ({
|
|
140
|
-
raiseCrudError: jest.fn(),
|
|
141
|
-
createCrudFormError: (message: string) => new Error(message),
|
|
142
|
-
normalizeCrudServerError: (err: any) => ({ message: err?.message ?? 'error' }),
|
|
143
|
-
}))
|
|
144
|
-
|
|
145
|
-
jest.mock('@open-mercato/ui/primitives/button', () => ({
|
|
146
|
-
Button: ({ children, ...props }: any) => (
|
|
147
|
-
<button {...props} type={props.type || 'button'}>
|
|
148
|
-
{children}
|
|
149
|
-
</button>
|
|
150
|
-
),
|
|
151
|
-
}))
|
|
152
|
-
|
|
153
|
-
jest.mock('@open-mercato/ui/primitives/input', () => ({
|
|
154
|
-
Input: ({ children, ...props }: any) => <input {...props}>{children}</input>,
|
|
155
|
-
}))
|
|
156
|
-
|
|
157
|
-
jest.mock('@open-mercato/ui/primitives/label', () => ({
|
|
158
|
-
Label: ({ children, ...props }: any) => <label {...props}>{children}</label>,
|
|
159
|
-
}))
|
|
160
|
-
|
|
161
|
-
jest.mock('@open-mercato/ui/primitives/switch', () => ({
|
|
162
|
-
Switch: ({ checked, onCheckedChange, ...props }: any) => (
|
|
163
|
-
<input
|
|
164
|
-
type="checkbox"
|
|
165
|
-
role="switch"
|
|
166
|
-
checked={!!checked}
|
|
167
|
-
onChange={(event) => onCheckedChange?.(event.target.checked)}
|
|
168
|
-
{...props}
|
|
169
|
-
/>
|
|
170
|
-
),
|
|
171
|
-
}))
|
|
172
|
-
|
|
173
|
-
jest.mock('@open-mercato/ui/primitives/textarea', () => ({
|
|
174
|
-
Textarea: ({ children, ...props }: any) => <textarea {...props}>{children}</textarea>,
|
|
175
|
-
}))
|
|
176
|
-
|
|
177
|
-
jest.mock('@open-mercato/ui/primitives/dialog', () => ({
|
|
178
|
-
Dialog: ({ children }: any) => <div>{children}</div>,
|
|
179
|
-
DialogContent: ({ children }: any) => <div>{children}</div>,
|
|
180
|
-
DialogDescription: ({ children }: any) => <p>{children}</p>,
|
|
181
|
-
DialogFooter: ({ children }: any) => <div>{children}</div>,
|
|
182
|
-
DialogHeader: ({ children }: any) => <div>{children}</div>,
|
|
183
|
-
DialogTitle: ({ children }: any) => <h3>{children}</h3>,
|
|
184
|
-
DialogTrigger: ({ children }: any) => <div>{children}</div>,
|
|
185
|
-
}))
|
|
186
|
-
|
|
187
|
-
jest.mock('@open-mercato/ui/primitives/badge', () => ({
|
|
188
|
-
Badge: ({ children }: any) => <span>{children}</span>,
|
|
189
|
-
}))
|
|
190
|
-
|
|
191
|
-
jest.mock('@open-mercato/core/modules/dictionaries/components/AppearanceSelector', () => ({
|
|
192
|
-
AppearanceSelector: () => <div>appearance</div>,
|
|
193
|
-
}))
|
|
194
|
-
|
|
195
|
-
jest.mock('@open-mercato/core/modules/dictionaries/components/dictionaryAppearance', () => ({
|
|
196
|
-
renderDictionaryColor: () => <span>color</span>,
|
|
197
|
-
renderDictionaryIcon: () => <span>icon</span>,
|
|
198
|
-
ICON_SUGGESTIONS: [],
|
|
199
|
-
}))
|
|
200
|
-
|
|
201
|
-
jest.mock('@open-mercato/core/modules/dictionaries/components/DictionaryForm', () => ({
|
|
202
|
-
DictionaryForm: ({ onSubmit, initialValues }: any) => (
|
|
203
|
-
<form
|
|
204
|
-
onSubmit={(event) => {
|
|
205
|
-
event.preventDefault()
|
|
206
|
-
onSubmit?.(initialValues ?? {})
|
|
207
|
-
}}
|
|
208
|
-
>
|
|
209
|
-
<button type="submit">save</button>
|
|
210
|
-
</form>
|
|
211
|
-
),
|
|
212
|
-
}))
|
|
213
|
-
|
|
214
|
-
jest.mock('@open-mercato/core/modules/dictionaries/components/DictionaryTable', () => ({
|
|
215
|
-
DictionaryTable: ({ entries = [] }: any) => (
|
|
216
|
-
<div data-testid="dictionary-table-count">{entries.length}</div>
|
|
217
|
-
),
|
|
218
|
-
}))
|
|
219
|
-
|
|
220
|
-
jest.mock('@open-mercato/core/modules/dictionaries/components/DictionaryEntrySelect', () => ({
|
|
221
|
-
DictionaryEntrySelect: ({ value, onChange }: any) => (
|
|
222
|
-
<select value={value ?? ''} onChange={(event) => onChange?.(event.target.value || null)}>
|
|
223
|
-
<option value="">Select</option>
|
|
224
|
-
</select>
|
|
225
|
-
),
|
|
226
|
-
}))
|
|
227
|
-
|
|
228
|
-
jest.mock('../../lib/providers', () => ({
|
|
229
|
-
listPaymentProviders: () => [
|
|
230
|
-
{
|
|
231
|
-
key: 'stripe',
|
|
232
|
-
label: 'Stripe',
|
|
233
|
-
settings: { fields: [{ key: 'secret', label: 'Secret', type: 'secret' }], defaults: { secret: 'demo' } },
|
|
234
|
-
},
|
|
235
|
-
],
|
|
236
|
-
listShippingProviders: () => [
|
|
237
|
-
{ key: 'flat', label: 'Flat rate', settings: { fields: [], defaults: {} } },
|
|
238
|
-
],
|
|
239
|
-
}))
|
|
240
|
-
|
|
241
|
-
jest.mock('@open-mercato/shared/lib/custom-fields/normalize', () => ({
|
|
242
|
-
normalizeCustomFieldResponse: (input: any) => input,
|
|
243
|
-
}))
|
|
244
|
-
|
|
245
|
-
jest.mock('@open-mercato/core/modules/sales/lib/frontend/documentTotalsEvents', () => ({
|
|
246
|
-
emitSalesDocumentTotalsRefresh: jest.fn(),
|
|
247
|
-
}))
|
|
248
|
-
|
|
249
|
-
jest.mock('@open-mercato/core/modules/customers/components/detail/hooks/useCurrencyDictionary', () => ({
|
|
250
|
-
useCurrencyDictionary: () => ({ data: { entries: [] }, refetch: jest.fn() }),
|
|
251
|
-
}))
|
|
252
|
-
|
|
253
|
-
jest.mock('@open-mercato/shared/lib/frontend/useOrganizationScope', () => ({
|
|
254
|
-
useOrganizationScopeDetail: () => ({ organizationId: 'org', tenantId: 'tenant' }),
|
|
255
|
-
}))
|
|
256
|
-
|
|
257
|
-
jest.mock('@open-mercato/shared/lib/frontend/useOrganizationScope', () => ({
|
|
258
|
-
useOrganizationScopeVersion: () => 1,
|
|
259
|
-
useOrganizationScopeDetail: () => ({ organizationId: 'org', tenantId: 'tenant' }),
|
|
260
|
-
}))
|
|
261
|
-
|
|
262
|
-
jest.mock('@open-mercato/shared/lib/i18n/context', () => {
|
|
263
|
-
// Provide actual translations so tests verify user-visible text
|
|
264
|
-
const dict: Record<string, string> = {
|
|
265
|
-
'sales.documents.detail.totals.title': 'Totals',
|
|
266
|
-
'sales.documents.detail.totals.showDetails': 'Show details',
|
|
267
|
-
'sales.documents.detail.totals.hideDetails': 'Hide details',
|
|
268
|
-
'sales.documents.detail.totals.showingAll': 'Showing all totals',
|
|
269
|
-
'sales.documents.detail.totals.showingKey': 'Showing key totals · {{count}} more',
|
|
270
|
-
}
|
|
271
|
-
const translate = (
|
|
272
|
-
key: string,
|
|
273
|
-
fallbackOrParams?: string | Record<string, unknown>,
|
|
274
|
-
params?: Record<string, unknown>
|
|
275
|
-
) => {
|
|
276
|
-
let fallback: string | undefined
|
|
277
|
-
let resolvedParams: Record<string, unknown> | undefined
|
|
278
|
-
|
|
279
|
-
if (typeof fallbackOrParams === 'string') {
|
|
280
|
-
fallback = fallbackOrParams
|
|
281
|
-
resolvedParams = params
|
|
282
|
-
} else {
|
|
283
|
-
resolvedParams = fallbackOrParams ?? params
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
const template = dict[key] ?? fallback ?? key
|
|
287
|
-
if (resolvedParams) {
|
|
288
|
-
return template.replace(/\{\{(\w+)\}\}|\{(\w+)\}/g, (match, doubleKey, singleKey) => {
|
|
289
|
-
const token = doubleKey ?? singleKey
|
|
290
|
-
if (!token) return match
|
|
291
|
-
const value = resolvedParams![token]
|
|
292
|
-
return value !== undefined ? String(value) : match
|
|
293
|
-
})
|
|
294
|
-
}
|
|
295
|
-
return template
|
|
296
|
-
}
|
|
297
|
-
return {
|
|
298
|
-
useT: () => translate,
|
|
299
|
-
}
|
|
300
|
-
})
|
|
301
|
-
|
|
302
|
-
jest.mock('next/navigation', () => ({
|
|
303
|
-
useRouter: () => ({ push: jest.fn(), refresh: jest.fn(), replace: jest.fn() }),
|
|
304
|
-
}))
|
|
305
|
-
|
|
306
|
-
jest.mock('next/link', () => ({
|
|
307
|
-
__esModule: true,
|
|
308
|
-
default: ({ children, ...props }: any) => <a {...props}>{children}</a>,
|
|
309
|
-
}))
|
|
310
|
-
|
|
311
|
-
describe('sales components', () => {
|
|
312
|
-
beforeEach(() => {
|
|
313
|
-
jest.clearAllMocks()
|
|
314
|
-
mockApiCall.mockResolvedValue({ ok: true, result: {} })
|
|
315
|
-
mockReadApiResultOrThrow.mockResolvedValue({ items: [] })
|
|
316
|
-
mockCreateCrud.mockResolvedValue({ ok: true })
|
|
317
|
-
mockUpdateCrud.mockResolvedValue({ ok: true })
|
|
318
|
-
mockDeleteCrud.mockResolvedValue({ ok: true })
|
|
319
|
-
})
|
|
320
|
-
|
|
321
|
-
it('formats prices with currency helper and component', () => {
|
|
322
|
-
// Intl.NumberFormat output is locale-dependent, accept either symbol or code
|
|
323
|
-
expect(formatPriceWithCurrency(10, 'USD')).toMatch(/\$|USD/)
|
|
324
|
-
expect(formatPriceWithCurrency(null, 'USD')).toBe('—')
|
|
325
|
-
render(<PriceWithCurrency amount={15} currency="EUR" />)
|
|
326
|
-
expect(screen.getByText(/€|EUR/)).toBeInTheDocument()
|
|
327
|
-
})
|
|
328
|
-
|
|
329
|
-
it('renders DocumentCustomerCard and triggers selection', () => {
|
|
330
|
-
const onSelect = jest.fn()
|
|
331
|
-
render(
|
|
332
|
-
<DocumentCustomerCard
|
|
333
|
-
label="Customer"
|
|
334
|
-
name="ACME"
|
|
335
|
-
email="test@example.com"
|
|
336
|
-
kind="company"
|
|
337
|
-
onSelectCustomer={onSelect}
|
|
338
|
-
/>,
|
|
339
|
-
)
|
|
340
|
-
expect(screen.getByText('Customer')).toBeInTheDocument()
|
|
341
|
-
fireEvent.click(screen.getByText('ACME'))
|
|
342
|
-
expect(onSelect).toHaveBeenCalled()
|
|
343
|
-
})
|
|
344
|
-
|
|
345
|
-
it('toggles DocumentTotals details', () => {
|
|
346
|
-
const items = [
|
|
347
|
-
{ key: 'subtotal', label: 'Subtotal', amount: 100 },
|
|
348
|
-
{ key: 'tax', label: 'Tax', amount: 20 },
|
|
349
|
-
{ key: 'shipping', label: 'Shipping', amount: 5 },
|
|
350
|
-
{ key: 'total', label: 'Total', amount: 120, emphasize: true },
|
|
351
|
-
]
|
|
352
|
-
render(<DocumentTotals currency="USD" items={items} title="Summary" />)
|
|
353
|
-
const toggle = screen.getByRole('button', { name: /show details/i })
|
|
354
|
-
fireEvent.click(toggle)
|
|
355
|
-
expect(screen.getByText('Subtotal')).toBeInTheDocument()
|
|
356
|
-
expect(screen.getByText('Total')).toBeInTheDocument()
|
|
357
|
-
})
|
|
358
|
-
|
|
359
|
-
it('loads adjustment kinds into table', async () => {
|
|
360
|
-
mockReadApiResultOrThrow.mockResolvedValueOnce({
|
|
361
|
-
items: [{ id: 'adj-1', value: 'discount', label: 'Discount', color: '#ff0000', icon: null }],
|
|
362
|
-
})
|
|
363
|
-
render(<AdjustmentKindSettings />)
|
|
364
|
-
await waitFor(() => expect(screen.getByTestId('data-table-count-table')).toHaveTextContent('1'))
|
|
365
|
-
})
|
|
366
|
-
|
|
367
|
-
it('renders payment methods settings table', async () => {
|
|
368
|
-
mockReadApiResultOrThrow.mockResolvedValueOnce({
|
|
369
|
-
items: [{ id: 'pm-1', name: 'Credit card', code: 'card', provider_key: 'stripe', providerKey: 'stripe' }],
|
|
370
|
-
})
|
|
371
|
-
render(<PaymentMethodsSettings />)
|
|
372
|
-
await waitFor(() => expect(screen.getByText(/Credit card/i)).toBeInTheDocument())
|
|
373
|
-
})
|
|
374
|
-
|
|
375
|
-
it('renders shipping methods settings table', async () => {
|
|
376
|
-
mockReadApiResultOrThrow.mockResolvedValueOnce({
|
|
377
|
-
items: [{ id: 'ship-1', name: 'Courier', code: 'courier', isActive: true }],
|
|
378
|
-
})
|
|
379
|
-
render(<ShippingMethodsSettings />)
|
|
380
|
-
await waitFor(() => expect(screen.getByText(/Courier/i)).toBeInTheDocument())
|
|
381
|
-
})
|
|
382
|
-
|
|
383
|
-
it('renders status settings with entries', async () => {
|
|
384
|
-
mockReadApiResultOrThrow
|
|
385
|
-
.mockResolvedValueOnce({ items: [{ id: 'st-1', value: 'new', label: 'New' }] })
|
|
386
|
-
.mockResolvedValueOnce({ items: [{ id: 'ln-1', value: 'processing', label: 'Processing' }] })
|
|
387
|
-
.mockResolvedValueOnce({ items: [{ id: 'sh-1', value: 'shipped', label: 'Shipped' }] })
|
|
388
|
-
.mockResolvedValueOnce({ items: [{ id: 'pay-1', value: 'paid', label: 'Paid' }] })
|
|
389
|
-
render(<StatusSettings />)
|
|
390
|
-
await waitFor(() => {
|
|
391
|
-
const tables = screen.getAllByTestId('dictionary-table-count')
|
|
392
|
-
expect(tables).toHaveLength(4)
|
|
393
|
-
tables.forEach((table) => expect(table).toHaveTextContent('1'))
|
|
394
|
-
})
|
|
395
|
-
})
|
|
396
|
-
|
|
397
|
-
it('renders tax rates settings rows', async () => {
|
|
398
|
-
mockReadApiResultOrThrow.mockResolvedValueOnce({
|
|
399
|
-
items: [{ id: 'tax-1', code: 'vat', label: 'VAT', rate: 23 }],
|
|
400
|
-
})
|
|
401
|
-
render(<TaxRatesSettings />)
|
|
402
|
-
await waitFor(() => expect(screen.getByText(/VAT/)).toBeInTheDocument())
|
|
403
|
-
})
|
|
404
|
-
|
|
405
|
-
it('renders document number settings with server data', async () => {
|
|
406
|
-
mockApiCall.mockResolvedValueOnce({
|
|
407
|
-
ok: true,
|
|
408
|
-
result: {
|
|
409
|
-
orderNumberFormat: 'ORD-{seq}',
|
|
410
|
-
quoteNumberFormat: 'QUO-{seq}',
|
|
411
|
-
nextOrderNumber: 10,
|
|
412
|
-
nextQuoteNumber: 5,
|
|
413
|
-
tokens: [],
|
|
414
|
-
},
|
|
415
|
-
})
|
|
416
|
-
render(<DocumentNumberSettings />)
|
|
417
|
-
await waitFor(() => expect(screen.getByDisplayValue('ORD-{seq}')).toBeInTheDocument())
|
|
418
|
-
expect(screen.getByDisplayValue('QUO-{seq}')).toBeInTheDocument()
|
|
419
|
-
})
|
|
420
|
-
|
|
421
|
-
it('renders order editing settings', async () => {
|
|
422
|
-
mockApiCall.mockResolvedValueOnce({
|
|
423
|
-
ok: true,
|
|
424
|
-
result: {
|
|
425
|
-
enabledStatuses: ['draft'],
|
|
426
|
-
enabledLineStatuses: ['open'],
|
|
427
|
-
allowPriceChanges: true,
|
|
428
|
-
allowQuantityChanges: true,
|
|
429
|
-
},
|
|
430
|
-
})
|
|
431
|
-
render(<OrderEditingSettings />)
|
|
432
|
-
await waitFor(() => expect(mockApiCall).toHaveBeenCalled())
|
|
433
|
-
expect(screen.getAllByRole('switch').length).toBeGreaterThan(0)
|
|
434
|
-
})
|
|
435
|
-
|
|
436
|
-
it('renders sales channel offers panel', async () => {
|
|
437
|
-
mockReadApiResultOrThrow.mockResolvedValueOnce({
|
|
438
|
-
items: [
|
|
439
|
-
{ id: 'offer-1', title: 'Offer A', isActive: true, productTitle: 'Product A', pricing: null, updatedAt: null },
|
|
440
|
-
],
|
|
441
|
-
total: 1,
|
|
442
|
-
totalPages: 1,
|
|
443
|
-
})
|
|
444
|
-
render(<SalesChannelOffersPanel channelId="channel-1" channelName="Online" />)
|
|
445
|
-
await waitFor(() => expect(screen.getAllByTestId('data-row').length).toBeGreaterThan(0))
|
|
446
|
-
})
|
|
447
|
-
|
|
448
|
-
it('renders channel offer form in create mode', async () => {
|
|
449
|
-
mockReadApiResultOrThrow.mockResolvedValue({
|
|
450
|
-
items: [],
|
|
451
|
-
})
|
|
452
|
-
render(<ChannelOfferForm channelId="channel-1" mode="create" />)
|
|
453
|
-
await waitFor(() => expect(mockReadApiResultOrThrow).toHaveBeenCalled())
|
|
454
|
-
expect(screen.getByRole('button', { name: /create|save|submit/i })).toBeInTheDocument()
|
|
455
|
-
})
|
|
456
|
-
})
|
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
calculateDocumentTotals,
|
|
3
|
-
registerSalesTotalsCalculator,
|
|
4
|
-
} from '../calculations'
|
|
5
|
-
import type { SalesAdjustmentDraft, SalesLineSnapshot } from '../types'
|
|
6
|
-
|
|
7
|
-
const baseContext = {
|
|
8
|
-
tenantId: 'tenant-1',
|
|
9
|
-
organizationId: 'org-1',
|
|
10
|
-
currencyCode: 'USD',
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
describe('calculateDocumentTotals', () => {
|
|
14
|
-
it('calculates order line totals and aggregates adjustments', async () => {
|
|
15
|
-
const lines: SalesLineSnapshot[] = [
|
|
16
|
-
{
|
|
17
|
-
kind: 'product',
|
|
18
|
-
quantity: 2,
|
|
19
|
-
currencyCode: 'USD',
|
|
20
|
-
unitPriceNet: 10,
|
|
21
|
-
taxRate: 20,
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
kind: 'product',
|
|
25
|
-
quantity: 1,
|
|
26
|
-
currencyCode: 'USD',
|
|
27
|
-
unitPriceGross: 12,
|
|
28
|
-
discountPercent: 10,
|
|
29
|
-
taxRate: 20,
|
|
30
|
-
},
|
|
31
|
-
]
|
|
32
|
-
const adjustments: SalesAdjustmentDraft[] = [
|
|
33
|
-
{
|
|
34
|
-
scope: 'order',
|
|
35
|
-
kind: 'discount',
|
|
36
|
-
amountNet: 5,
|
|
37
|
-
amountGross: 5,
|
|
38
|
-
currencyCode: 'USD',
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
scope: 'order',
|
|
42
|
-
kind: 'shipping',
|
|
43
|
-
rate: 10,
|
|
44
|
-
currencyCode: 'USD',
|
|
45
|
-
metadata: { taxRateValue: 20 },
|
|
46
|
-
},
|
|
47
|
-
]
|
|
48
|
-
|
|
49
|
-
const result = await calculateDocumentTotals({
|
|
50
|
-
documentKind: 'order',
|
|
51
|
-
lines,
|
|
52
|
-
adjustments,
|
|
53
|
-
context: { ...baseContext, metadata: {} },
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
expect(result.lines).toHaveLength(2)
|
|
57
|
-
expect(result.lines[0]).toMatchObject({
|
|
58
|
-
netAmount: 20,
|
|
59
|
-
grossAmount: 24,
|
|
60
|
-
taxAmount: 4,
|
|
61
|
-
discountAmount: 0,
|
|
62
|
-
})
|
|
63
|
-
expect(result.lines[1].netAmount).toBeCloseTo(9, 4)
|
|
64
|
-
expect(result.lines[1].grossAmount).toBeCloseTo(10.8, 4)
|
|
65
|
-
expect(result.lines[1].discountAmount).toBeCloseTo(1, 4)
|
|
66
|
-
|
|
67
|
-
const shippingAdj = result.adjustments.find((adj) => adj.kind === 'shipping')
|
|
68
|
-
expect(shippingAdj?.amountNet).toBeCloseTo(2.9, 4)
|
|
69
|
-
expect(shippingAdj?.amountGross).toBeCloseTo(3.48, 4)
|
|
70
|
-
|
|
71
|
-
expect(result.totals.subtotalNetAmount).toBeCloseTo(26.9, 4)
|
|
72
|
-
expect(result.totals.subtotalGrossAmount).toBeCloseTo(33.28, 4)
|
|
73
|
-
expect(result.totals.discountTotalAmount).toBeCloseTo(6, 4)
|
|
74
|
-
expect(result.totals.taxTotalAmount).toBeCloseTo(6.38, 4)
|
|
75
|
-
expect(result.totals.shippingNetAmount).toBeCloseTo(2.9, 4)
|
|
76
|
-
expect(result.totals.shippingGrossAmount).toBeCloseTo(3.48, 4)
|
|
77
|
-
expect(result.totals.grandTotalGrossAmount).toBeCloseTo(33.28, 4)
|
|
78
|
-
expect(result.totals.outstandingAmount).toBeCloseTo(33.28, 4)
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
it('calculates quote totals per line with discounts', async () => {
|
|
82
|
-
const lines: SalesLineSnapshot[] = [
|
|
83
|
-
{
|
|
84
|
-
kind: 'product',
|
|
85
|
-
quantity: 3,
|
|
86
|
-
currencyCode: 'USD',
|
|
87
|
-
unitPriceNet: 15,
|
|
88
|
-
discountPercent: 10,
|
|
89
|
-
taxRate: 0,
|
|
90
|
-
},
|
|
91
|
-
]
|
|
92
|
-
|
|
93
|
-
const result = await calculateDocumentTotals({
|
|
94
|
-
documentKind: 'quote',
|
|
95
|
-
lines,
|
|
96
|
-
adjustments: [],
|
|
97
|
-
context: { ...baseContext, metadata: {} },
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
expect(result.lines[0].netAmount).toBeCloseTo(40.5, 4)
|
|
101
|
-
expect(result.lines[0].discountAmount).toBeCloseTo(4.5, 4)
|
|
102
|
-
expect(result.totals.subtotalNetAmount).toBeCloseTo(40.5, 4)
|
|
103
|
-
expect(result.totals.subtotalGrossAmount).toBeCloseTo(40.5, 4)
|
|
104
|
-
expect(result.totals.discountTotalAmount).toBeCloseTo(4.5, 4)
|
|
105
|
-
expect(result.totals.grandTotalGrossAmount).toBeCloseTo(40.5, 4)
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
it('keeps manual adjustment amounts when rate defaults to zero', async () => {
|
|
109
|
-
const lines: SalesLineSnapshot[] = [
|
|
110
|
-
{
|
|
111
|
-
kind: 'product',
|
|
112
|
-
quantity: 1,
|
|
113
|
-
currencyCode: 'USD',
|
|
114
|
-
unitPriceNet: 10,
|
|
115
|
-
taxRate: 0,
|
|
116
|
-
},
|
|
117
|
-
]
|
|
118
|
-
|
|
119
|
-
const adjustments: SalesAdjustmentDraft[] = [
|
|
120
|
-
{
|
|
121
|
-
scope: 'order',
|
|
122
|
-
kind: 'shipping',
|
|
123
|
-
rate: 0,
|
|
124
|
-
amountNet: 9.9,
|
|
125
|
-
amountGross: 9.9,
|
|
126
|
-
currencyCode: 'USD',
|
|
127
|
-
metadata: { manualOverride: true },
|
|
128
|
-
},
|
|
129
|
-
]
|
|
130
|
-
|
|
131
|
-
const result = await calculateDocumentTotals({
|
|
132
|
-
documentKind: 'order',
|
|
133
|
-
lines,
|
|
134
|
-
adjustments,
|
|
135
|
-
context: { ...baseContext, metadata: {} },
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
const shipping = result.adjustments.find((entry) => entry.kind === 'shipping')
|
|
139
|
-
expect(shipping?.amountNet).toBeCloseTo(9.9, 4)
|
|
140
|
-
expect(shipping?.amountGross).toBeCloseTo(9.9, 4)
|
|
141
|
-
expect(result.totals.shippingNetAmount).toBeCloseTo(9.9, 4)
|
|
142
|
-
expect(result.totals.shippingGrossAmount).toBeCloseTo(9.9, 4)
|
|
143
|
-
})
|
|
144
|
-
|
|
145
|
-
it('preserves existing payment totals when recalculating order amounts', async () => {
|
|
146
|
-
const lines: SalesLineSnapshot[] = [
|
|
147
|
-
{
|
|
148
|
-
kind: 'product',
|
|
149
|
-
quantity: 2,
|
|
150
|
-
currencyCode: 'USD',
|
|
151
|
-
unitPriceGross: 50,
|
|
152
|
-
taxRate: 0,
|
|
153
|
-
},
|
|
154
|
-
]
|
|
155
|
-
|
|
156
|
-
const result = await calculateDocumentTotals({
|
|
157
|
-
documentKind: 'order',
|
|
158
|
-
lines,
|
|
159
|
-
adjustments: [],
|
|
160
|
-
context: { ...baseContext, metadata: {} },
|
|
161
|
-
existingTotals: { paidTotalAmount: 25, refundedTotalAmount: 5 },
|
|
162
|
-
})
|
|
163
|
-
|
|
164
|
-
expect(result.totals.grandTotalGrossAmount).toBeCloseTo(100, 4)
|
|
165
|
-
expect(result.totals.paidTotalAmount).toBe(25)
|
|
166
|
-
expect(result.totals.refundedTotalAmount).toBe(5)
|
|
167
|
-
expect(result.totals.outstandingAmount).toBeCloseTo(80, 4)
|
|
168
|
-
})
|
|
169
|
-
|
|
170
|
-
it('supports overriding payment-aware totals via calculators', async () => {
|
|
171
|
-
const unregister = registerSalesTotalsCalculator(({ current, context }) => {
|
|
172
|
-
const payments = (context.metadata as any)?.payments ?? {}
|
|
173
|
-
const paid = Number(payments.paid ?? 0)
|
|
174
|
-
const refunded = Number(payments.refunded ?? 0)
|
|
175
|
-
const outstanding = Math.max(current.totals.grandTotalGrossAmount - paid + refunded, 0)
|
|
176
|
-
return {
|
|
177
|
-
...current,
|
|
178
|
-
totals: {
|
|
179
|
-
...current.totals,
|
|
180
|
-
paidTotalAmount: paid,
|
|
181
|
-
refundedTotalAmount: refunded,
|
|
182
|
-
outstandingAmount: outstanding,
|
|
183
|
-
},
|
|
184
|
-
}
|
|
185
|
-
})
|
|
186
|
-
|
|
187
|
-
try {
|
|
188
|
-
const result = await calculateDocumentTotals({
|
|
189
|
-
documentKind: 'order',
|
|
190
|
-
lines: [
|
|
191
|
-
{
|
|
192
|
-
kind: 'product',
|
|
193
|
-
quantity: 1,
|
|
194
|
-
currencyCode: 'USD',
|
|
195
|
-
unitPriceNet: 100,
|
|
196
|
-
taxRate: 0,
|
|
197
|
-
},
|
|
198
|
-
],
|
|
199
|
-
context: { ...baseContext, metadata: { payments: { paid: 40, refunded: 5 } } },
|
|
200
|
-
})
|
|
201
|
-
|
|
202
|
-
expect(result.totals.grandTotalGrossAmount).toBeCloseTo(100, 4)
|
|
203
|
-
expect(result.totals.paidTotalAmount).toBe(40)
|
|
204
|
-
expect(result.totals.refundedTotalAmount).toBe(5)
|
|
205
|
-
expect(result.totals.outstandingAmount).toBeCloseTo(65, 4)
|
|
206
|
-
} finally {
|
|
207
|
-
unregister()
|
|
208
|
-
}
|
|
209
|
-
})
|
|
210
|
-
})
|