@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,398 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, jest, beforeEach } from '@jest/globals'
|
|
2
|
-
import { RateFetchingService } from '../rateFetchingService'
|
|
3
|
-
import {
|
|
4
|
-
createMockEntityManager,
|
|
5
|
-
createMockProvider,
|
|
6
|
-
createTestCurrency,
|
|
7
|
-
createTestRate,
|
|
8
|
-
createTestExchangeRate,
|
|
9
|
-
TEST_SCOPE,
|
|
10
|
-
TEST_DATE,
|
|
11
|
-
} from './rateFetchingService.setup'
|
|
12
|
-
|
|
13
|
-
describe('RateFetchingService - Basic Functionality', () => {
|
|
14
|
-
let service: RateFetchingService
|
|
15
|
-
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
jest.clearAllMocks()
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
describe('successful fetch operations', () => {
|
|
21
|
-
it('fetches rates from all providers and returns aggregated results', async () => {
|
|
22
|
-
// Setup
|
|
23
|
-
const currencies = [
|
|
24
|
-
createTestCurrency({ code: 'PLN', name: 'Polish Zloty' }),
|
|
25
|
-
createTestCurrency({ code: 'EUR', name: 'Euro' }),
|
|
26
|
-
]
|
|
27
|
-
|
|
28
|
-
const { em } = createMockEntityManager({ currencies })
|
|
29
|
-
service = new RateFetchingService(em)
|
|
30
|
-
|
|
31
|
-
const provider1 = createMockProvider({
|
|
32
|
-
source: 'PROVIDER1',
|
|
33
|
-
rates: [createTestRate({ fromCurrencyCode: 'PLN', toCurrencyCode: 'EUR', source: 'PROVIDER1' })],
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
const provider2 = createMockProvider({
|
|
37
|
-
source: 'PROVIDER2',
|
|
38
|
-
rates: [createTestRate({ fromCurrencyCode: 'EUR', toCurrencyCode: 'PLN', source: 'PROVIDER2' })],
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
service.registerProvider(provider1)
|
|
42
|
-
service.registerProvider(provider2)
|
|
43
|
-
|
|
44
|
-
// Execute
|
|
45
|
-
const result = await service.fetchRatesForDate(TEST_DATE, TEST_SCOPE)
|
|
46
|
-
|
|
47
|
-
// Assert
|
|
48
|
-
expect(result.totalFetched).toBe(2)
|
|
49
|
-
expect(result.byProvider['PROVIDER1']).toEqual({ count: 1 })
|
|
50
|
-
expect(result.byProvider['PROVIDER2']).toEqual({ count: 1 })
|
|
51
|
-
expect(result.errors).toEqual([])
|
|
52
|
-
expect(provider1.fetchRates).toHaveBeenCalledWith(TEST_DATE, TEST_SCOPE, new Set(['PLN', 'EUR']))
|
|
53
|
-
expect(provider2.fetchRates).toHaveBeenCalledWith(TEST_DATE, TEST_SCOPE, new Set(['PLN', 'EUR']))
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
it('stores fetched rates in database using transactions', async () => {
|
|
57
|
-
// Setup
|
|
58
|
-
const currencies = [
|
|
59
|
-
createTestCurrency({ code: 'USD' }),
|
|
60
|
-
createTestCurrency({ code: 'EUR' }),
|
|
61
|
-
]
|
|
62
|
-
|
|
63
|
-
const { em } = createMockEntityManager({ currencies })
|
|
64
|
-
service = new RateFetchingService(em)
|
|
65
|
-
|
|
66
|
-
const provider = createMockProvider({
|
|
67
|
-
source: 'TEST',
|
|
68
|
-
rates: [createTestRate({ fromCurrencyCode: 'USD', toCurrencyCode: 'EUR' })],
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
service.registerProvider(provider)
|
|
72
|
-
|
|
73
|
-
// Execute
|
|
74
|
-
await service.fetchRatesForDate(TEST_DATE, TEST_SCOPE)
|
|
75
|
-
|
|
76
|
-
// Assert
|
|
77
|
-
expect(em.transactional).toHaveBeenCalled()
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
it('creates new exchange rates when they do not exist', async () => {
|
|
81
|
-
// Setup
|
|
82
|
-
const currencies = [
|
|
83
|
-
createTestCurrency({ code: 'USD' }),
|
|
84
|
-
createTestCurrency({ code: 'EUR' }),
|
|
85
|
-
]
|
|
86
|
-
|
|
87
|
-
const { em } = createMockEntityManager({ currencies })
|
|
88
|
-
service = new RateFetchingService(em)
|
|
89
|
-
|
|
90
|
-
const testRate = createTestRate({ fromCurrencyCode: 'USD', toCurrencyCode: 'EUR', rate: '0.92' })
|
|
91
|
-
const provider = createMockProvider({
|
|
92
|
-
source: 'TEST',
|
|
93
|
-
rates: [testRate],
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
service.registerProvider(provider)
|
|
97
|
-
|
|
98
|
-
// Execute
|
|
99
|
-
await service.fetchRatesForDate(TEST_DATE, TEST_SCOPE)
|
|
100
|
-
|
|
101
|
-
// Assert - create should be called within the transaction
|
|
102
|
-
expect(em.transactional).toHaveBeenCalled()
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
it('updates existing exchange rates when found', async () => {
|
|
106
|
-
// Setup
|
|
107
|
-
const currencies = [
|
|
108
|
-
createTestCurrency({ code: 'USD' }),
|
|
109
|
-
createTestCurrency({ code: 'EUR' }),
|
|
110
|
-
]
|
|
111
|
-
|
|
112
|
-
const existingRate = createTestExchangeRate({
|
|
113
|
-
fromCurrencyCode: 'USD',
|
|
114
|
-
toCurrencyCode: 'EUR',
|
|
115
|
-
rate: '0.85',
|
|
116
|
-
date: TEST_DATE,
|
|
117
|
-
source: 'TEST',
|
|
118
|
-
})
|
|
119
|
-
|
|
120
|
-
const { em } = createMockEntityManager({ currencies, existingRates: [existingRate] })
|
|
121
|
-
service = new RateFetchingService(em)
|
|
122
|
-
|
|
123
|
-
const updatedRate = createTestRate({
|
|
124
|
-
fromCurrencyCode: 'USD',
|
|
125
|
-
toCurrencyCode: 'EUR',
|
|
126
|
-
rate: '0.92',
|
|
127
|
-
date: TEST_DATE,
|
|
128
|
-
source: 'TEST',
|
|
129
|
-
})
|
|
130
|
-
|
|
131
|
-
const provider = createMockProvider({
|
|
132
|
-
source: 'TEST',
|
|
133
|
-
rates: [updatedRate],
|
|
134
|
-
})
|
|
135
|
-
|
|
136
|
-
service.registerProvider(provider)
|
|
137
|
-
|
|
138
|
-
// Execute
|
|
139
|
-
const result = await service.fetchRatesForDate(TEST_DATE, TEST_SCOPE)
|
|
140
|
-
|
|
141
|
-
// Assert
|
|
142
|
-
expect(result.totalFetched).toBe(1)
|
|
143
|
-
expect(em.transactional).toHaveBeenCalled()
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
it('passes correct scope to provider fetchRates', async () => {
|
|
147
|
-
// Setup
|
|
148
|
-
const customScope = { tenantId: 'custom-tenant', organizationId: 'custom-org' }
|
|
149
|
-
const currencies = [
|
|
150
|
-
createTestCurrency({
|
|
151
|
-
code: 'USD',
|
|
152
|
-
tenantId: customScope.tenantId,
|
|
153
|
-
organizationId: customScope.organizationId,
|
|
154
|
-
}),
|
|
155
|
-
]
|
|
156
|
-
const { em } = createMockEntityManager({ currencies })
|
|
157
|
-
service = new RateFetchingService(em)
|
|
158
|
-
|
|
159
|
-
const provider = createMockProvider({
|
|
160
|
-
source: 'TEST',
|
|
161
|
-
rates: [],
|
|
162
|
-
})
|
|
163
|
-
|
|
164
|
-
service.registerProvider(provider)
|
|
165
|
-
|
|
166
|
-
// Execute
|
|
167
|
-
await service.fetchRatesForDate(TEST_DATE, customScope)
|
|
168
|
-
|
|
169
|
-
// Assert
|
|
170
|
-
expect(provider.fetchRates).toHaveBeenCalledWith(TEST_DATE, customScope, new Set(['USD']))
|
|
171
|
-
})
|
|
172
|
-
})
|
|
173
|
-
|
|
174
|
-
describe('currency filtering (critical)', () => {
|
|
175
|
-
it('only stores rates where both currencies exist and are active', async () => {
|
|
176
|
-
// Setup
|
|
177
|
-
const currencies = [
|
|
178
|
-
createTestCurrency({ code: 'PLN' }),
|
|
179
|
-
createTestCurrency({ code: 'EUR' }),
|
|
180
|
-
]
|
|
181
|
-
|
|
182
|
-
const { em } = createMockEntityManager({ currencies })
|
|
183
|
-
service = new RateFetchingService(em)
|
|
184
|
-
|
|
185
|
-
const provider = createMockProvider({
|
|
186
|
-
source: 'TEST',
|
|
187
|
-
rates: [
|
|
188
|
-
createTestRate({ fromCurrencyCode: 'PLN', toCurrencyCode: 'EUR' }), // Valid
|
|
189
|
-
createTestRate({ fromCurrencyCode: 'PLN', toCurrencyCode: 'USD' }), // USD not in DB
|
|
190
|
-
createTestRate({ fromCurrencyCode: 'EUR', toCurrencyCode: 'GBP' }), // GBP not in DB
|
|
191
|
-
],
|
|
192
|
-
})
|
|
193
|
-
|
|
194
|
-
service.registerProvider(provider)
|
|
195
|
-
|
|
196
|
-
// Execute
|
|
197
|
-
const result = await service.fetchRatesForDate(TEST_DATE, TEST_SCOPE)
|
|
198
|
-
|
|
199
|
-
// Assert - only 1 rate should be stored (PLN→EUR)
|
|
200
|
-
expect(result.totalFetched).toBe(1)
|
|
201
|
-
})
|
|
202
|
-
|
|
203
|
-
it('filters out rates involving inactive currencies', async () => {
|
|
204
|
-
// Setup
|
|
205
|
-
const currencies = [
|
|
206
|
-
createTestCurrency({ code: 'USD', isActive: true }),
|
|
207
|
-
createTestCurrency({ code: 'EUR', isActive: false }), // Inactive
|
|
208
|
-
]
|
|
209
|
-
|
|
210
|
-
const { em } = createMockEntityManager({ currencies })
|
|
211
|
-
service = new RateFetchingService(em)
|
|
212
|
-
|
|
213
|
-
const provider = createMockProvider({
|
|
214
|
-
source: 'TEST',
|
|
215
|
-
rates: [
|
|
216
|
-
createTestRate({ fromCurrencyCode: 'USD', toCurrencyCode: 'EUR' }),
|
|
217
|
-
],
|
|
218
|
-
})
|
|
219
|
-
|
|
220
|
-
service.registerProvider(provider)
|
|
221
|
-
|
|
222
|
-
// Execute
|
|
223
|
-
const result = await service.fetchRatesForDate(TEST_DATE, TEST_SCOPE)
|
|
224
|
-
|
|
225
|
-
// Assert - EUR is inactive, so currency set should only contain USD
|
|
226
|
-
// The rate USD→EUR should be filtered out
|
|
227
|
-
expect(result.totalFetched).toBe(0)
|
|
228
|
-
})
|
|
229
|
-
|
|
230
|
-
it('filters out rates involving soft-deleted currencies', async () => {
|
|
231
|
-
// Setup
|
|
232
|
-
const currencies = [
|
|
233
|
-
createTestCurrency({ code: 'USD', deletedAt: null }),
|
|
234
|
-
createTestCurrency({ code: 'EUR', deletedAt: new Date() }), // Soft-deleted
|
|
235
|
-
]
|
|
236
|
-
|
|
237
|
-
const { em } = createMockEntityManager({ currencies })
|
|
238
|
-
service = new RateFetchingService(em)
|
|
239
|
-
|
|
240
|
-
const provider = createMockProvider({
|
|
241
|
-
source: 'TEST',
|
|
242
|
-
rates: [
|
|
243
|
-
createTestRate({ fromCurrencyCode: 'USD', toCurrencyCode: 'EUR' }),
|
|
244
|
-
],
|
|
245
|
-
})
|
|
246
|
-
|
|
247
|
-
service.registerProvider(provider)
|
|
248
|
-
|
|
249
|
-
// Execute
|
|
250
|
-
const result = await service.fetchRatesForDate(TEST_DATE, TEST_SCOPE)
|
|
251
|
-
|
|
252
|
-
// Assert - EUR is soft-deleted, so should be filtered
|
|
253
|
-
expect(result.totalFetched).toBe(0)
|
|
254
|
-
})
|
|
255
|
-
|
|
256
|
-
it('queries currencies with correct tenant and organization scope', async () => {
|
|
257
|
-
// Setup
|
|
258
|
-
const currencies = [createTestCurrency({ code: 'USD' })]
|
|
259
|
-
const { em } = createMockEntityManager({ currencies })
|
|
260
|
-
service = new RateFetchingService(em)
|
|
261
|
-
|
|
262
|
-
const provider = createMockProvider({ source: 'TEST', rates: [] })
|
|
263
|
-
service.registerProvider(provider)
|
|
264
|
-
|
|
265
|
-
const customScope = { tenantId: 'tenant-123', organizationId: 'org-456' }
|
|
266
|
-
|
|
267
|
-
// Execute
|
|
268
|
-
await service.fetchRatesForDate(TEST_DATE, customScope)
|
|
269
|
-
|
|
270
|
-
// Assert
|
|
271
|
-
expect(em.find).toHaveBeenCalledWith(
|
|
272
|
-
expect.anything(),
|
|
273
|
-
expect.objectContaining({
|
|
274
|
-
tenantId: 'tenant-123',
|
|
275
|
-
organizationId: 'org-456',
|
|
276
|
-
isActive: true,
|
|
277
|
-
deletedAt: null,
|
|
278
|
-
})
|
|
279
|
-
)
|
|
280
|
-
})
|
|
281
|
-
|
|
282
|
-
it('handles empty currency list gracefully', async () => {
|
|
283
|
-
// Setup - no currencies in database
|
|
284
|
-
const { em } = createMockEntityManager({ currencies: [] })
|
|
285
|
-
service = new RateFetchingService(em)
|
|
286
|
-
|
|
287
|
-
const provider = createMockProvider({
|
|
288
|
-
source: 'TEST',
|
|
289
|
-
rates: [createTestRate()],
|
|
290
|
-
})
|
|
291
|
-
|
|
292
|
-
service.registerProvider(provider)
|
|
293
|
-
|
|
294
|
-
// Execute
|
|
295
|
-
const result = await service.fetchRatesForDate(TEST_DATE, TEST_SCOPE)
|
|
296
|
-
|
|
297
|
-
// Assert
|
|
298
|
-
expect(result.totalFetched).toBe(0)
|
|
299
|
-
expect(result.errors).toEqual([])
|
|
300
|
-
expect(provider.fetchRates).toHaveBeenCalledWith(TEST_DATE, TEST_SCOPE, new Set([]))
|
|
301
|
-
})
|
|
302
|
-
})
|
|
303
|
-
|
|
304
|
-
describe('result structure', () => {
|
|
305
|
-
it('returns correct totalFetched count', async () => {
|
|
306
|
-
// Setup
|
|
307
|
-
const currencies = [
|
|
308
|
-
createTestCurrency({ code: 'USD' }),
|
|
309
|
-
createTestCurrency({ code: 'EUR' }),
|
|
310
|
-
createTestCurrency({ code: 'GBP' }),
|
|
311
|
-
]
|
|
312
|
-
|
|
313
|
-
const { em } = createMockEntityManager({ currencies })
|
|
314
|
-
service = new RateFetchingService(em)
|
|
315
|
-
|
|
316
|
-
const provider1 = createMockProvider({
|
|
317
|
-
source: 'PROVIDER1',
|
|
318
|
-
rates: [
|
|
319
|
-
createTestRate({ fromCurrencyCode: 'USD', toCurrencyCode: 'EUR' }),
|
|
320
|
-
createTestRate({ fromCurrencyCode: 'USD', toCurrencyCode: 'GBP' }),
|
|
321
|
-
],
|
|
322
|
-
})
|
|
323
|
-
|
|
324
|
-
const provider2 = createMockProvider({
|
|
325
|
-
source: 'PROVIDER2',
|
|
326
|
-
rates: [
|
|
327
|
-
createTestRate({ fromCurrencyCode: 'EUR', toCurrencyCode: 'USD' }),
|
|
328
|
-
createTestRate({ fromCurrencyCode: 'GBP', toCurrencyCode: 'USD' }),
|
|
329
|
-
],
|
|
330
|
-
})
|
|
331
|
-
|
|
332
|
-
service.registerProvider(provider1)
|
|
333
|
-
service.registerProvider(provider2)
|
|
334
|
-
|
|
335
|
-
// Execute
|
|
336
|
-
const result = await service.fetchRatesForDate(TEST_DATE, TEST_SCOPE)
|
|
337
|
-
|
|
338
|
-
// Assert
|
|
339
|
-
expect(result.totalFetched).toBe(4)
|
|
340
|
-
})
|
|
341
|
-
|
|
342
|
-
it('returns per-provider counts in byProvider', async () => {
|
|
343
|
-
// Setup
|
|
344
|
-
const currencies = [
|
|
345
|
-
createTestCurrency({ code: 'USD' }),
|
|
346
|
-
createTestCurrency({ code: 'EUR' }),
|
|
347
|
-
]
|
|
348
|
-
|
|
349
|
-
const { em } = createMockEntityManager({ currencies })
|
|
350
|
-
service = new RateFetchingService(em)
|
|
351
|
-
|
|
352
|
-
const provider1 = createMockProvider({
|
|
353
|
-
source: 'SOURCE1',
|
|
354
|
-
rates: [
|
|
355
|
-
createTestRate({ fromCurrencyCode: 'USD', toCurrencyCode: 'EUR' }),
|
|
356
|
-
createTestRate({ fromCurrencyCode: 'EUR', toCurrencyCode: 'USD' }),
|
|
357
|
-
],
|
|
358
|
-
})
|
|
359
|
-
|
|
360
|
-
const provider2 = createMockProvider({
|
|
361
|
-
source: 'SOURCE2',
|
|
362
|
-
rates: [
|
|
363
|
-
createTestRate({ fromCurrencyCode: 'USD', toCurrencyCode: 'EUR' }),
|
|
364
|
-
],
|
|
365
|
-
})
|
|
366
|
-
|
|
367
|
-
service.registerProvider(provider1)
|
|
368
|
-
service.registerProvider(provider2)
|
|
369
|
-
|
|
370
|
-
// Execute
|
|
371
|
-
const result = await service.fetchRatesForDate(TEST_DATE, TEST_SCOPE)
|
|
372
|
-
|
|
373
|
-
// Assert
|
|
374
|
-
expect(result.byProvider['SOURCE1']).toEqual({ count: 2 })
|
|
375
|
-
expect(result.byProvider['SOURCE2']).toEqual({ count: 1 })
|
|
376
|
-
})
|
|
377
|
-
|
|
378
|
-
it('returns empty errors array when all succeed', async () => {
|
|
379
|
-
// Setup
|
|
380
|
-
const currencies = [createTestCurrency({ code: 'USD' })]
|
|
381
|
-
const { em } = createMockEntityManager({ currencies })
|
|
382
|
-
service = new RateFetchingService(em)
|
|
383
|
-
|
|
384
|
-
const provider = createMockProvider({
|
|
385
|
-
source: 'TEST',
|
|
386
|
-
rates: [],
|
|
387
|
-
})
|
|
388
|
-
|
|
389
|
-
service.registerProvider(provider)
|
|
390
|
-
|
|
391
|
-
// Execute
|
|
392
|
-
const result = await service.fetchRatesForDate(TEST_DATE, TEST_SCOPE)
|
|
393
|
-
|
|
394
|
-
// Assert
|
|
395
|
-
expect(result.errors).toEqual([])
|
|
396
|
-
})
|
|
397
|
-
})
|
|
398
|
-
})
|
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, jest, beforeEach } from '@jest/globals'
|
|
2
|
-
import { RateFetchingService } from '../rateFetchingService'
|
|
3
|
-
import {
|
|
4
|
-
createMockEntityManager,
|
|
5
|
-
createMockProvider,
|
|
6
|
-
createTestCurrency,
|
|
7
|
-
createTestRate,
|
|
8
|
-
TEST_SCOPE,
|
|
9
|
-
TEST_DATE,
|
|
10
|
-
} from './rateFetchingService.setup'
|
|
11
|
-
|
|
12
|
-
describe('RateFetchingService - Error Handling', () => {
|
|
13
|
-
let service: RateFetchingService
|
|
14
|
-
|
|
15
|
-
beforeEach(() => {
|
|
16
|
-
jest.clearAllMocks()
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
describe('provider errors', () => {
|
|
20
|
-
it('catches provider fetch errors and continues with other providers', async () => {
|
|
21
|
-
// Setup
|
|
22
|
-
const currencies = [
|
|
23
|
-
createTestCurrency({ code: 'USD' }),
|
|
24
|
-
createTestCurrency({ code: 'EUR' }),
|
|
25
|
-
]
|
|
26
|
-
|
|
27
|
-
const { em } = createMockEntityManager({ currencies })
|
|
28
|
-
service = new RateFetchingService(em)
|
|
29
|
-
|
|
30
|
-
const failingProvider = createMockProvider({
|
|
31
|
-
source: 'FAILING',
|
|
32
|
-
error: new Error('Network timeout'),
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
const successProvider = createMockProvider({
|
|
36
|
-
source: 'SUCCESS',
|
|
37
|
-
rates: [createTestRate({ fromCurrencyCode: 'USD', toCurrencyCode: 'EUR' })],
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
service.registerProvider(failingProvider)
|
|
41
|
-
service.registerProvider(successProvider)
|
|
42
|
-
|
|
43
|
-
// Execute
|
|
44
|
-
const result = await service.fetchRatesForDate(TEST_DATE, TEST_SCOPE)
|
|
45
|
-
|
|
46
|
-
// Assert
|
|
47
|
-
expect(result.totalFetched).toBe(1) // Only from success provider
|
|
48
|
-
expect(result.byProvider['SUCCESS']).toEqual({ count: 1 })
|
|
49
|
-
expect(result.errors).toContain('FAILING: Network timeout')
|
|
50
|
-
expect(successProvider.fetchRates).toHaveBeenCalled()
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
it('records provider-specific errors in byProvider', async () => {
|
|
54
|
-
// Setup
|
|
55
|
-
const currencies = [createTestCurrency({ code: 'USD' })]
|
|
56
|
-
const { em } = createMockEntityManager({ currencies })
|
|
57
|
-
service = new RateFetchingService(em)
|
|
58
|
-
|
|
59
|
-
const provider = createMockProvider({
|
|
60
|
-
source: 'ERROR_SOURCE',
|
|
61
|
-
error: new Error('API rate limit exceeded'),
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
service.registerProvider(provider)
|
|
65
|
-
|
|
66
|
-
// Execute
|
|
67
|
-
const result = await service.fetchRatesForDate(TEST_DATE, TEST_SCOPE)
|
|
68
|
-
|
|
69
|
-
// Assert
|
|
70
|
-
expect(result.byProvider['ERROR_SOURCE']).toEqual({
|
|
71
|
-
count: 0,
|
|
72
|
-
errors: ['API rate limit exceeded'],
|
|
73
|
-
})
|
|
74
|
-
expect(result.errors).toContain('ERROR_SOURCE: API rate limit exceeded')
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
it('sets count to 0 for providers that fail', async () => {
|
|
78
|
-
// Setup
|
|
79
|
-
const currencies = [createTestCurrency({ code: 'USD' })]
|
|
80
|
-
const { em } = createMockEntityManager({ currencies })
|
|
81
|
-
service = new RateFetchingService(em)
|
|
82
|
-
|
|
83
|
-
const provider = createMockProvider({
|
|
84
|
-
source: 'FAILED',
|
|
85
|
-
error: new Error('Connection refused'),
|
|
86
|
-
})
|
|
87
|
-
|
|
88
|
-
service.registerProvider(provider)
|
|
89
|
-
|
|
90
|
-
// Execute
|
|
91
|
-
const result = await service.fetchRatesForDate(TEST_DATE, TEST_SCOPE)
|
|
92
|
-
|
|
93
|
-
// Assert
|
|
94
|
-
expect(result.byProvider['FAILED'].count).toBe(0)
|
|
95
|
-
expect(result.totalFetched).toBe(0)
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
it('includes both provider errors and general errors in result', async () => {
|
|
99
|
-
// Setup
|
|
100
|
-
const currencies = [createTestCurrency({ code: 'USD' })]
|
|
101
|
-
const { em } = createMockEntityManager({ currencies })
|
|
102
|
-
service = new RateFetchingService(em)
|
|
103
|
-
|
|
104
|
-
const failingProvider = createMockProvider({
|
|
105
|
-
source: 'FAILING',
|
|
106
|
-
error: new Error('Provider error'),
|
|
107
|
-
})
|
|
108
|
-
|
|
109
|
-
service.registerProvider(failingProvider)
|
|
110
|
-
|
|
111
|
-
// Execute - also request an unknown provider
|
|
112
|
-
const result = await service.fetchRatesForDate(TEST_DATE, TEST_SCOPE, {
|
|
113
|
-
providers: ['UNKNOWN', 'FAILING'],
|
|
114
|
-
})
|
|
115
|
-
|
|
116
|
-
// Assert
|
|
117
|
-
expect(result.errors).toContain('Unknown provider: UNKNOWN')
|
|
118
|
-
expect(result.errors).toContain('FAILING: Provider error')
|
|
119
|
-
expect(result.errors.length).toBe(2)
|
|
120
|
-
})
|
|
121
|
-
})
|
|
122
|
-
|
|
123
|
-
describe('edge cases', () => {
|
|
124
|
-
it('handles empty currency list gracefully', async () => {
|
|
125
|
-
// Setup - no currencies in database
|
|
126
|
-
const { em } = createMockEntityManager({ currencies: [] })
|
|
127
|
-
service = new RateFetchingService(em)
|
|
128
|
-
|
|
129
|
-
const provider = createMockProvider({
|
|
130
|
-
source: 'TEST',
|
|
131
|
-
rates: [createTestRate()],
|
|
132
|
-
})
|
|
133
|
-
|
|
134
|
-
service.registerProvider(provider)
|
|
135
|
-
|
|
136
|
-
// Execute
|
|
137
|
-
const result = await service.fetchRatesForDate(TEST_DATE, TEST_SCOPE)
|
|
138
|
-
|
|
139
|
-
// Assert
|
|
140
|
-
expect(result.totalFetched).toBe(0)
|
|
141
|
-
expect(result.errors).toEqual([])
|
|
142
|
-
// Provider should still be called, just with empty currency set
|
|
143
|
-
expect(provider.fetchRates).toHaveBeenCalledWith(TEST_DATE, TEST_SCOPE, new Set([]))
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
it('handles providers returning empty arrays', async () => {
|
|
147
|
-
// Setup
|
|
148
|
-
const currencies = [createTestCurrency({ code: 'USD' })]
|
|
149
|
-
const { em } = createMockEntityManager({ currencies })
|
|
150
|
-
service = new RateFetchingService(em)
|
|
151
|
-
|
|
152
|
-
const provider = createMockProvider({
|
|
153
|
-
source: 'EMPTY',
|
|
154
|
-
rates: [], // Returns no rates
|
|
155
|
-
})
|
|
156
|
-
|
|
157
|
-
service.registerProvider(provider)
|
|
158
|
-
|
|
159
|
-
// Execute
|
|
160
|
-
const result = await service.fetchRatesForDate(TEST_DATE, TEST_SCOPE)
|
|
161
|
-
|
|
162
|
-
// Assert
|
|
163
|
-
expect(result.totalFetched).toBe(0)
|
|
164
|
-
expect(result.byProvider['EMPTY']).toEqual({ count: 0 })
|
|
165
|
-
expect(result.errors).toEqual([])
|
|
166
|
-
})
|
|
167
|
-
|
|
168
|
-
it('handles date objects correctly', async () => {
|
|
169
|
-
// Setup
|
|
170
|
-
const currencies = [
|
|
171
|
-
createTestCurrency({ code: 'USD' }),
|
|
172
|
-
createTestCurrency({ code: 'EUR' }),
|
|
173
|
-
]
|
|
174
|
-
|
|
175
|
-
const { em } = createMockEntityManager({ currencies })
|
|
176
|
-
service = new RateFetchingService(em)
|
|
177
|
-
|
|
178
|
-
const provider = createMockProvider({
|
|
179
|
-
source: 'TEST',
|
|
180
|
-
rates: [createTestRate({ fromCurrencyCode: 'USD', toCurrencyCode: 'EUR' })],
|
|
181
|
-
})
|
|
182
|
-
|
|
183
|
-
service.registerProvider(provider)
|
|
184
|
-
|
|
185
|
-
const testDate = new Date('2024-03-15T14:30:00.000Z')
|
|
186
|
-
|
|
187
|
-
// Execute
|
|
188
|
-
await service.fetchRatesForDate(testDate, TEST_SCOPE)
|
|
189
|
-
|
|
190
|
-
// Assert
|
|
191
|
-
expect(provider.fetchRates).toHaveBeenCalledWith(testDate, TEST_SCOPE, expect.any(Set))
|
|
192
|
-
})
|
|
193
|
-
|
|
194
|
-
it('stores rates with correct scope information', async () => {
|
|
195
|
-
// Setup
|
|
196
|
-
const currencies = [
|
|
197
|
-
createTestCurrency({ code: 'USD' }),
|
|
198
|
-
createTestCurrency({ code: 'EUR' }),
|
|
199
|
-
]
|
|
200
|
-
|
|
201
|
-
const { em } = createMockEntityManager({ currencies })
|
|
202
|
-
service = new RateFetchingService(em)
|
|
203
|
-
|
|
204
|
-
const provider = createMockProvider({
|
|
205
|
-
source: 'TEST',
|
|
206
|
-
rates: [createTestRate({ fromCurrencyCode: 'USD', toCurrencyCode: 'EUR' })],
|
|
207
|
-
})
|
|
208
|
-
|
|
209
|
-
service.registerProvider(provider)
|
|
210
|
-
|
|
211
|
-
const customScope = { tenantId: 'tenant-abc', organizationId: 'org-xyz' }
|
|
212
|
-
|
|
213
|
-
// Execute
|
|
214
|
-
await service.fetchRatesForDate(TEST_DATE, customScope)
|
|
215
|
-
|
|
216
|
-
// Assert - verify transactional was called (rates stored with scope)
|
|
217
|
-
expect(em.transactional).toHaveBeenCalled()
|
|
218
|
-
})
|
|
219
|
-
|
|
220
|
-
it('handles multiple rates from same provider correctly', async () => {
|
|
221
|
-
// Setup
|
|
222
|
-
const currencies = [
|
|
223
|
-
createTestCurrency({ code: 'USD' }),
|
|
224
|
-
createTestCurrency({ code: 'EUR' }),
|
|
225
|
-
createTestCurrency({ code: 'GBP' }),
|
|
226
|
-
createTestCurrency({ code: 'CHF' }),
|
|
227
|
-
]
|
|
228
|
-
|
|
229
|
-
const { em } = createMockEntityManager({ currencies })
|
|
230
|
-
service = new RateFetchingService(em)
|
|
231
|
-
|
|
232
|
-
// Provider returns many rates
|
|
233
|
-
const rates = [
|
|
234
|
-
createTestRate({ fromCurrencyCode: 'USD', toCurrencyCode: 'EUR' }),
|
|
235
|
-
createTestRate({ fromCurrencyCode: 'USD', toCurrencyCode: 'GBP' }),
|
|
236
|
-
createTestRate({ fromCurrencyCode: 'USD', toCurrencyCode: 'CHF' }),
|
|
237
|
-
createTestRate({ fromCurrencyCode: 'EUR', toCurrencyCode: 'USD' }),
|
|
238
|
-
createTestRate({ fromCurrencyCode: 'EUR', toCurrencyCode: 'GBP' }),
|
|
239
|
-
createTestRate({ fromCurrencyCode: 'EUR', toCurrencyCode: 'CHF' }),
|
|
240
|
-
createTestRate({ fromCurrencyCode: 'GBP', toCurrencyCode: 'USD' }),
|
|
241
|
-
createTestRate({ fromCurrencyCode: 'GBP', toCurrencyCode: 'EUR' }),
|
|
242
|
-
createTestRate({ fromCurrencyCode: 'CHF', toCurrencyCode: 'USD' }),
|
|
243
|
-
createTestRate({ fromCurrencyCode: 'CHF', toCurrencyCode: 'EUR' }),
|
|
244
|
-
]
|
|
245
|
-
|
|
246
|
-
const provider = createMockProvider({
|
|
247
|
-
source: 'MULTI',
|
|
248
|
-
rates,
|
|
249
|
-
})
|
|
250
|
-
|
|
251
|
-
service.registerProvider(provider)
|
|
252
|
-
|
|
253
|
-
// Execute
|
|
254
|
-
const result = await service.fetchRatesForDate(TEST_DATE, TEST_SCOPE)
|
|
255
|
-
|
|
256
|
-
// Assert
|
|
257
|
-
expect(result.totalFetched).toBe(10)
|
|
258
|
-
expect(result.byProvider['MULTI']).toEqual({ count: 10 })
|
|
259
|
-
})
|
|
260
|
-
})
|
|
261
|
-
|
|
262
|
-
describe('database errors', () => {
|
|
263
|
-
it('catches transaction errors and includes them in result', async () => {
|
|
264
|
-
// Setup
|
|
265
|
-
const currencies = [
|
|
266
|
-
createTestCurrency({ code: 'USD' }),
|
|
267
|
-
createTestCurrency({ code: 'EUR' }),
|
|
268
|
-
]
|
|
269
|
-
|
|
270
|
-
const { em } = createMockEntityManager({
|
|
271
|
-
currencies,
|
|
272
|
-
shouldFailTransaction: true,
|
|
273
|
-
})
|
|
274
|
-
|
|
275
|
-
service = new RateFetchingService(em)
|
|
276
|
-
|
|
277
|
-
const provider = createMockProvider({
|
|
278
|
-
source: 'TEST',
|
|
279
|
-
rates: [createTestRate({ fromCurrencyCode: 'USD', toCurrencyCode: 'EUR' })],
|
|
280
|
-
})
|
|
281
|
-
|
|
282
|
-
service.registerProvider(provider)
|
|
283
|
-
|
|
284
|
-
// Execute
|
|
285
|
-
const result = await service.fetchRatesForDate(TEST_DATE, TEST_SCOPE)
|
|
286
|
-
|
|
287
|
-
// Assert - transaction error should be caught and included in errors
|
|
288
|
-
expect(result.totalFetched).toBe(0)
|
|
289
|
-
expect(result.errors).toContain('TEST: Transaction failed')
|
|
290
|
-
expect(result.byProvider['TEST']).toEqual({
|
|
291
|
-
count: 0,
|
|
292
|
-
errors: ['Transaction failed'],
|
|
293
|
-
})
|
|
294
|
-
})
|
|
295
|
-
})
|
|
296
|
-
})
|