@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,89 +0,0 @@
|
|
|
1
|
-
process.env.TZ = 'UTC'
|
|
2
|
-
|
|
3
|
-
import { getMergedAvailabilityWindows, type AvailabilityRuleLike } from '../lib/availabilityMerge'
|
|
4
|
-
import { DefaultPlannerAvailabilityService } from '../services/plannerAvailabilityService'
|
|
5
|
-
|
|
6
|
-
function toIsoWindow(window: { start: Date; end: Date; ruleId?: string }) {
|
|
7
|
-
return {
|
|
8
|
-
start: window.start.toISOString(),
|
|
9
|
-
end: window.end.toISOString(),
|
|
10
|
-
ruleId: window.ruleId,
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
describe('DefaultPlannerAvailabilityService', () => {
|
|
15
|
-
it('delegates to getMergedAvailabilityWindows', () => {
|
|
16
|
-
const range = {
|
|
17
|
-
start: new Date('2024-01-01T00:00:00Z'),
|
|
18
|
-
end: new Date('2024-01-03T00:00:00Z'),
|
|
19
|
-
}
|
|
20
|
-
const rules: AvailabilityRuleLike[] = [
|
|
21
|
-
{
|
|
22
|
-
id: 'availability',
|
|
23
|
-
rrule: 'DTSTART:20240101T090000Z;DURATION:PT2H;FREQ=DAILY;COUNT=2',
|
|
24
|
-
kind: 'availability',
|
|
25
|
-
},
|
|
26
|
-
]
|
|
27
|
-
|
|
28
|
-
const service = new DefaultPlannerAvailabilityService()
|
|
29
|
-
const direct = getMergedAvailabilityWindows({ rules, range }).map(toIsoWindow)
|
|
30
|
-
const viaService = service.getMergedAvailabilityWindows({ rules, range }).map(toIsoWindow)
|
|
31
|
-
|
|
32
|
-
expect(viaService).toEqual(direct)
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
it('merges unavailability into availability windows', () => {
|
|
36
|
-
const service = new DefaultPlannerAvailabilityService()
|
|
37
|
-
const range = {
|
|
38
|
-
start: new Date('2024-01-01T00:00:00Z'),
|
|
39
|
-
end: new Date('2024-01-02T00:00:00Z'),
|
|
40
|
-
}
|
|
41
|
-
const rules: AvailabilityRuleLike[] = [
|
|
42
|
-
{
|
|
43
|
-
id: 'availability',
|
|
44
|
-
rrule: 'DTSTART:20240101T090000Z;DURATION:PT8H;FREQ=DAILY',
|
|
45
|
-
kind: 'availability',
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
id: 'unavailability',
|
|
49
|
-
rrule: 'DTSTART:20240101T120000Z;DURATION:PT1H;FREQ=DAILY',
|
|
50
|
-
kind: 'unavailability',
|
|
51
|
-
},
|
|
52
|
-
]
|
|
53
|
-
|
|
54
|
-
const windows = service.getMergedAvailabilityWindows({ rules, range }).map(toIsoWindow)
|
|
55
|
-
|
|
56
|
-
expect(windows).toEqual([
|
|
57
|
-
{ start: '2024-01-01T09:00:00.000Z', end: '2024-01-01T12:00:00.000Z', ruleId: 'availability' },
|
|
58
|
-
{ start: '2024-01-01T13:00:00.000Z', end: '2024-01-01T17:00:00.000Z', ruleId: 'availability' },
|
|
59
|
-
])
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
it('respects exdates and one-off overrides', () => {
|
|
63
|
-
const service = new DefaultPlannerAvailabilityService()
|
|
64
|
-
const range = {
|
|
65
|
-
start: new Date('2024-01-02T00:00:00Z'),
|
|
66
|
-
end: new Date('2024-01-04T00:00:00Z'),
|
|
67
|
-
}
|
|
68
|
-
const rules: AvailabilityRuleLike[] = [
|
|
69
|
-
{
|
|
70
|
-
id: 'availability',
|
|
71
|
-
rrule: 'DTSTART:20240102T090000Z;DURATION:PT2H;FREQ=DAILY;COUNT=2',
|
|
72
|
-
exdates: ['2024-01-03'],
|
|
73
|
-
kind: 'availability',
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
id: 'once',
|
|
77
|
-
rrule: 'DTSTART:20240103T090000Z;DURATION:PT1H;FREQ=DAILY;COUNT=1',
|
|
78
|
-
kind: 'availability',
|
|
79
|
-
},
|
|
80
|
-
]
|
|
81
|
-
|
|
82
|
-
const windows = service.getMergedAvailabilityWindows({ rules, range }).map(toIsoWindow)
|
|
83
|
-
|
|
84
|
-
expect(windows).toEqual([
|
|
85
|
-
{ start: '2024-01-02T09:00:00.000Z', end: '2024-01-02T11:00:00.000Z', ruleId: 'availability' },
|
|
86
|
-
{ start: '2024-01-03T00:00:00.000Z', end: '2024-01-04T00:00:00.000Z', ruleId: undefined },
|
|
87
|
-
])
|
|
88
|
-
})
|
|
89
|
-
})
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from '@jest/globals'
|
|
2
|
-
import {
|
|
3
|
-
plannerAvailabilityDateSpecificReplaceSchema,
|
|
4
|
-
plannerAvailabilityRuleCreateSchema,
|
|
5
|
-
plannerAvailabilityWeeklyReplaceSchema,
|
|
6
|
-
} from '../validators'
|
|
7
|
-
|
|
8
|
-
const tenantId = '123e4567-e89b-12d3-a456-426614174000'
|
|
9
|
-
const organizationId = '123e4567-e89b-12d3-a456-426614174001'
|
|
10
|
-
|
|
11
|
-
describe('Planner validators', () => {
|
|
12
|
-
test('plannerAvailabilityRuleCreateSchema applies defaults', () => {
|
|
13
|
-
const result = plannerAvailabilityRuleCreateSchema.parse({
|
|
14
|
-
tenantId,
|
|
15
|
-
organizationId,
|
|
16
|
-
subjectType: 'member',
|
|
17
|
-
subjectId: '123e4567-e89b-12d3-a456-426614174002',
|
|
18
|
-
timezone: 'UTC',
|
|
19
|
-
rrule: 'FREQ=WEEKLY;BYDAY=MO',
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
expect(result.exdates).toEqual([])
|
|
23
|
-
expect(result.kind).toBe('availability')
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
test('plannerAvailabilityRuleCreateSchema rejects invalid exdates', () => {
|
|
27
|
-
expect(() =>
|
|
28
|
-
plannerAvailabilityRuleCreateSchema.parse({
|
|
29
|
-
tenantId,
|
|
30
|
-
organizationId,
|
|
31
|
-
subjectType: 'member',
|
|
32
|
-
subjectId: '123e4567-e89b-12d3-a456-426614174002',
|
|
33
|
-
timezone: 'UTC',
|
|
34
|
-
rrule: 'FREQ=WEEKLY;BYDAY=MO',
|
|
35
|
-
exdates: ['not-a-date'],
|
|
36
|
-
}),
|
|
37
|
-
).toThrow()
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
test('plannerAvailabilityWeeklyReplaceSchema rejects invalid time windows', () => {
|
|
41
|
-
expect(() =>
|
|
42
|
-
plannerAvailabilityWeeklyReplaceSchema.parse({
|
|
43
|
-
tenantId,
|
|
44
|
-
organizationId,
|
|
45
|
-
subjectType: 'resource',
|
|
46
|
-
subjectId: '123e4567-e89b-12d3-a456-426614174003',
|
|
47
|
-
timezone: 'UTC',
|
|
48
|
-
windows: [{ weekday: 1, start: '9:00', end: '18:00' }],
|
|
49
|
-
}),
|
|
50
|
-
).toThrow()
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
test('plannerAvailabilityDateSpecificReplaceSchema requires date or dates', () => {
|
|
54
|
-
expect(() =>
|
|
55
|
-
plannerAvailabilityDateSpecificReplaceSchema.parse({
|
|
56
|
-
tenantId,
|
|
57
|
-
organizationId,
|
|
58
|
-
subjectType: 'ruleset',
|
|
59
|
-
subjectId: '123e4567-e89b-12d3-a456-426614174004',
|
|
60
|
-
timezone: 'UTC',
|
|
61
|
-
}),
|
|
62
|
-
).toThrow()
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
test('plannerAvailabilityDateSpecificReplaceSchema applies defaults', () => {
|
|
66
|
-
const result = plannerAvailabilityDateSpecificReplaceSchema.parse({
|
|
67
|
-
tenantId,
|
|
68
|
-
organizationId,
|
|
69
|
-
subjectType: 'ruleset',
|
|
70
|
-
subjectId: '123e4567-e89b-12d3-a456-426614174004',
|
|
71
|
-
timezone: 'UTC',
|
|
72
|
-
date: '2025-02-09',
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
expect(result.windows).toEqual([])
|
|
76
|
-
expect(result.isAvailable).toBe(true)
|
|
77
|
-
})
|
|
78
|
-
})
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { test, expect } from '@playwright/test';
|
|
2
|
-
import { getAuthToken, apiRequest } from '@open-mercato/core/modules/core/__integration__/helpers/api';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* TC-PROG-001: Progress Job Lifecycle
|
|
6
|
-
* Covers: create, list active, update progress, cancel
|
|
7
|
-
*/
|
|
8
|
-
test.describe('TC-PROG-001: Progress Job Lifecycle', () => {
|
|
9
|
-
test('should create, list, update, and cancel a progress job', async ({ request }) => {
|
|
10
|
-
let token: string | null = null;
|
|
11
|
-
let jobId: string | null = null;
|
|
12
|
-
|
|
13
|
-
try {
|
|
14
|
-
token = await getAuthToken(request);
|
|
15
|
-
|
|
16
|
-
// 1. Create a job via POST /api/progress/jobs
|
|
17
|
-
const createRes = await apiRequest(request, 'POST', '/api/progress/jobs', {
|
|
18
|
-
token,
|
|
19
|
-
data: {
|
|
20
|
-
jobType: 'integration-test',
|
|
21
|
-
name: `QA TC-PROG-001 ${Date.now()}`,
|
|
22
|
-
totalCount: 200,
|
|
23
|
-
cancellable: true,
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
expect(createRes.status()).toBe(201);
|
|
27
|
-
const createBody = await createRes.json();
|
|
28
|
-
expect(createBody.id).toBeTruthy();
|
|
29
|
-
jobId = createBody.id;
|
|
30
|
-
|
|
31
|
-
// 2. Verify it appears in GET /api/progress/active
|
|
32
|
-
const activeRes = await apiRequest(request, 'GET', '/api/progress/active', { token });
|
|
33
|
-
expect(activeRes.ok()).toBeTruthy();
|
|
34
|
-
const activeBody = await activeRes.json();
|
|
35
|
-
const activeIds = activeBody.active.map((j: { id: string }) => j.id);
|
|
36
|
-
expect(activeIds).toContain(jobId);
|
|
37
|
-
|
|
38
|
-
// 3. Update progress via PUT /api/progress/jobs/:id
|
|
39
|
-
const updateRes = await apiRequest(request, 'PUT', `/api/progress/jobs/${jobId}`, {
|
|
40
|
-
token,
|
|
41
|
-
data: { processedCount: 80, totalCount: 200 },
|
|
42
|
-
});
|
|
43
|
-
expect(updateRes.ok()).toBeTruthy();
|
|
44
|
-
const updateBody = await updateRes.json();
|
|
45
|
-
expect(updateBody.ok).toBe(true);
|
|
46
|
-
expect(updateBody.progressPercent).toBe(40);
|
|
47
|
-
|
|
48
|
-
// 4. Cancel job via DELETE /api/progress/jobs/:id
|
|
49
|
-
const cancelRes = await apiRequest(request, 'DELETE', `/api/progress/jobs/${jobId}`, { token });
|
|
50
|
-
expect(cancelRes.ok()).toBeTruthy();
|
|
51
|
-
const cancelBody = await cancelRes.json();
|
|
52
|
-
expect(cancelBody.ok).toBe(true);
|
|
53
|
-
|
|
54
|
-
// 5. Verify the job is now cancelled (pending jobs cancel immediately)
|
|
55
|
-
const detailRes = await apiRequest(request, 'GET', `/api/progress/jobs/${jobId}`, { token });
|
|
56
|
-
expect(detailRes.ok()).toBeTruthy();
|
|
57
|
-
const detailBody = await detailRes.json();
|
|
58
|
-
expect(detailBody.status).toBe('cancelled');
|
|
59
|
-
} finally {
|
|
60
|
-
// Jobs are soft state — no explicit cleanup needed.
|
|
61
|
-
// If the test created a job that wasn't cancelled, cancel it to keep state clean.
|
|
62
|
-
if (token && jobId) {
|
|
63
|
-
await apiRequest(request, 'DELETE', `/api/progress/jobs/${jobId}`, { token }).catch(() => {});
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
});
|
|
@@ -1,377 +0,0 @@
|
|
|
1
|
-
import { createProgressService } from '../lib/progressServiceImpl'
|
|
2
|
-
import { PROGRESS_EVENTS } from '../lib/events'
|
|
3
|
-
import { calculateEta, calculateProgressPercent } from '../lib/progressService'
|
|
4
|
-
import type { ProgressJob } from '../data/entities'
|
|
5
|
-
|
|
6
|
-
const baseCtx = {
|
|
7
|
-
tenantId: '7f4c85ef-f8f7-4e53-9df1-42e95bd8d48e',
|
|
8
|
-
organizationId: null,
|
|
9
|
-
userId: '2d4a4c33-9c4b-4e39-8e15-0a3cd9a7f432',
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const buildEm = () => {
|
|
13
|
-
const em = {
|
|
14
|
-
create: jest.fn(),
|
|
15
|
-
persistAndFlush: jest.fn().mockResolvedValue(undefined),
|
|
16
|
-
flush: jest.fn().mockResolvedValue(undefined),
|
|
17
|
-
findOne: jest.fn(),
|
|
18
|
-
findOneOrFail: jest.fn(),
|
|
19
|
-
find: jest.fn(),
|
|
20
|
-
}
|
|
21
|
-
return em
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
describe('progress service', () => {
|
|
25
|
-
beforeEach(() => {
|
|
26
|
-
jest.clearAllMocks()
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
it('createJob — creates entity, persists, emits JOB_CREATED', async () => {
|
|
30
|
-
const em = buildEm()
|
|
31
|
-
const eventBus = { emit: jest.fn().mockResolvedValue(undefined) }
|
|
32
|
-
|
|
33
|
-
em.create.mockImplementation((_entity, data) => ({ id: 'job-1', ...data }))
|
|
34
|
-
|
|
35
|
-
const service = createProgressService(em as never, eventBus)
|
|
36
|
-
|
|
37
|
-
const input = { jobType: 'import', name: 'Import contacts', totalCount: 100, cancellable: true }
|
|
38
|
-
const job = await service.createJob(input, baseCtx)
|
|
39
|
-
|
|
40
|
-
expect(job.id).toBe('job-1')
|
|
41
|
-
expect(job.status).toBe('pending')
|
|
42
|
-
expect(job.jobType).toBe('import')
|
|
43
|
-
expect(job.cancellable).toBe(true)
|
|
44
|
-
expect(em.persistAndFlush).toHaveBeenCalledWith(job)
|
|
45
|
-
expect(eventBus.emit).toHaveBeenCalledWith(
|
|
46
|
-
PROGRESS_EVENTS.JOB_CREATED,
|
|
47
|
-
expect.objectContaining({
|
|
48
|
-
jobId: 'job-1',
|
|
49
|
-
jobType: 'import',
|
|
50
|
-
name: 'Import contacts',
|
|
51
|
-
tenantId: baseCtx.tenantId,
|
|
52
|
-
})
|
|
53
|
-
)
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
it('startJob — sets running status, timestamps, emits JOB_STARTED', async () => {
|
|
57
|
-
const em = buildEm()
|
|
58
|
-
const eventBus = { emit: jest.fn().mockResolvedValue(undefined) }
|
|
59
|
-
|
|
60
|
-
const job = { id: 'job-1', status: 'pending', jobType: 'import' } as ProgressJob
|
|
61
|
-
em.findOneOrFail.mockResolvedValue(job)
|
|
62
|
-
|
|
63
|
-
const service = createProgressService(em as never, eventBus)
|
|
64
|
-
const result = await service.startJob('job-1', baseCtx)
|
|
65
|
-
|
|
66
|
-
expect(result.status).toBe('running')
|
|
67
|
-
expect(result.startedAt).toBeInstanceOf(Date)
|
|
68
|
-
expect(result.heartbeatAt).toBeInstanceOf(Date)
|
|
69
|
-
expect(em.flush).toHaveBeenCalled()
|
|
70
|
-
expect(eventBus.emit).toHaveBeenCalledWith(
|
|
71
|
-
PROGRESS_EVENTS.JOB_STARTED,
|
|
72
|
-
expect.objectContaining({ jobId: 'job-1', jobType: 'import', tenantId: baseCtx.tenantId })
|
|
73
|
-
)
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
it('updateProgress — auto-calculates progressPercent and ETA', async () => {
|
|
77
|
-
const em = buildEm()
|
|
78
|
-
const eventBus = { emit: jest.fn().mockResolvedValue(undefined) }
|
|
79
|
-
|
|
80
|
-
const job = {
|
|
81
|
-
id: 'job-1',
|
|
82
|
-
jobType: 'import',
|
|
83
|
-
processedCount: 0,
|
|
84
|
-
totalCount: 100,
|
|
85
|
-
progressPercent: 0,
|
|
86
|
-
startedAt: new Date(Date.now() - 10_000),
|
|
87
|
-
meta: null,
|
|
88
|
-
} as unknown as ProgressJob
|
|
89
|
-
em.findOneOrFail.mockResolvedValue(job)
|
|
90
|
-
|
|
91
|
-
const service = createProgressService(em as never, eventBus)
|
|
92
|
-
const result = await service.updateProgress('job-1', { processedCount: 50 }, baseCtx)
|
|
93
|
-
|
|
94
|
-
expect(result.processedCount).toBe(50)
|
|
95
|
-
expect(result.progressPercent).toBe(50)
|
|
96
|
-
expect(result.etaSeconds).toBeGreaterThan(0)
|
|
97
|
-
expect(result.heartbeatAt).toBeInstanceOf(Date)
|
|
98
|
-
expect(em.flush).toHaveBeenCalled()
|
|
99
|
-
expect(eventBus.emit).toHaveBeenCalledWith(
|
|
100
|
-
PROGRESS_EVENTS.JOB_UPDATED,
|
|
101
|
-
expect.objectContaining({ jobId: 'job-1', processedCount: 50, progressPercent: 50 })
|
|
102
|
-
)
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
it('updateProgress — uses explicit progressPercent when provided', async () => {
|
|
106
|
-
const em = buildEm()
|
|
107
|
-
const eventBus = { emit: jest.fn().mockResolvedValue(undefined) }
|
|
108
|
-
|
|
109
|
-
const job = {
|
|
110
|
-
id: 'job-1',
|
|
111
|
-
jobType: 'import',
|
|
112
|
-
processedCount: 0,
|
|
113
|
-
totalCount: 100,
|
|
114
|
-
progressPercent: 0,
|
|
115
|
-
startedAt: new Date(),
|
|
116
|
-
meta: null,
|
|
117
|
-
} as unknown as ProgressJob
|
|
118
|
-
em.findOneOrFail.mockResolvedValue(job)
|
|
119
|
-
|
|
120
|
-
const service = createProgressService(em as never, eventBus)
|
|
121
|
-
const result = await service.updateProgress('job-1', { processedCount: 50, progressPercent: 75 }, baseCtx)
|
|
122
|
-
|
|
123
|
-
expect(result.progressPercent).toBe(75)
|
|
124
|
-
})
|
|
125
|
-
|
|
126
|
-
it('updateProgress — merges meta instead of replacing', async () => {
|
|
127
|
-
const em = buildEm()
|
|
128
|
-
const eventBus = { emit: jest.fn().mockResolvedValue(undefined) }
|
|
129
|
-
|
|
130
|
-
const job = {
|
|
131
|
-
id: 'job-1',
|
|
132
|
-
jobType: 'import',
|
|
133
|
-
processedCount: 0,
|
|
134
|
-
totalCount: null,
|
|
135
|
-
progressPercent: 0,
|
|
136
|
-
startedAt: null,
|
|
137
|
-
meta: { existing: 'value' },
|
|
138
|
-
} as unknown as ProgressJob
|
|
139
|
-
em.findOneOrFail.mockResolvedValue(job)
|
|
140
|
-
|
|
141
|
-
const service = createProgressService(em as never, eventBus)
|
|
142
|
-
await service.updateProgress('job-1', { meta: { added: 'new' } }, baseCtx)
|
|
143
|
-
|
|
144
|
-
expect(job.meta).toEqual({ existing: 'value', added: 'new' })
|
|
145
|
-
})
|
|
146
|
-
|
|
147
|
-
it('incrementProgress — adds delta, recalculates percent, emits JOB_UPDATED', async () => {
|
|
148
|
-
const em = buildEm()
|
|
149
|
-
const eventBus = { emit: jest.fn().mockResolvedValue(undefined) }
|
|
150
|
-
|
|
151
|
-
const job = {
|
|
152
|
-
id: 'job-1',
|
|
153
|
-
jobType: 'import',
|
|
154
|
-
processedCount: 40,
|
|
155
|
-
totalCount: 100,
|
|
156
|
-
progressPercent: 40,
|
|
157
|
-
startedAt: new Date(Date.now() - 10_000),
|
|
158
|
-
} as unknown as ProgressJob
|
|
159
|
-
em.findOneOrFail.mockResolvedValue(job)
|
|
160
|
-
|
|
161
|
-
const service = createProgressService(em as never, eventBus)
|
|
162
|
-
const result = await service.incrementProgress('job-1', 10, baseCtx)
|
|
163
|
-
|
|
164
|
-
expect(result.processedCount).toBe(50)
|
|
165
|
-
expect(result.progressPercent).toBe(50)
|
|
166
|
-
expect(result.heartbeatAt).toBeInstanceOf(Date)
|
|
167
|
-
expect(em.flush).toHaveBeenCalled()
|
|
168
|
-
expect(eventBus.emit).toHaveBeenCalledWith(
|
|
169
|
-
PROGRESS_EVENTS.JOB_UPDATED,
|
|
170
|
-
expect.objectContaining({ jobId: 'job-1', processedCount: 50, progressPercent: 50 })
|
|
171
|
-
)
|
|
172
|
-
})
|
|
173
|
-
|
|
174
|
-
it('completeJob — sets completed status, progress 100%, emits JOB_COMPLETED', async () => {
|
|
175
|
-
const em = buildEm()
|
|
176
|
-
const eventBus = { emit: jest.fn().mockResolvedValue(undefined) }
|
|
177
|
-
|
|
178
|
-
const job = {
|
|
179
|
-
id: 'job-1',
|
|
180
|
-
jobType: 'import',
|
|
181
|
-
status: 'running',
|
|
182
|
-
progressPercent: 80,
|
|
183
|
-
etaSeconds: 5,
|
|
184
|
-
tenantId: baseCtx.tenantId,
|
|
185
|
-
} as unknown as ProgressJob
|
|
186
|
-
em.findOne.mockResolvedValue(job)
|
|
187
|
-
|
|
188
|
-
const service = createProgressService(em as never, eventBus)
|
|
189
|
-
const result = await service.completeJob('job-1', { resultSummary: { imported: 100 } }, baseCtx)
|
|
190
|
-
|
|
191
|
-
expect(result.status).toBe('completed')
|
|
192
|
-
expect(result.progressPercent).toBe(100)
|
|
193
|
-
expect(result.etaSeconds).toBe(0)
|
|
194
|
-
expect(result.finishedAt).toBeInstanceOf(Date)
|
|
195
|
-
expect(result.resultSummary).toEqual({ imported: 100 })
|
|
196
|
-
expect(em.flush).toHaveBeenCalled()
|
|
197
|
-
expect(em.findOne).toHaveBeenCalledWith(
|
|
198
|
-
expect.anything(),
|
|
199
|
-
expect.objectContaining({ id: 'job-1', tenantId: baseCtx.tenantId })
|
|
200
|
-
)
|
|
201
|
-
expect(eventBus.emit).toHaveBeenCalledWith(
|
|
202
|
-
PROGRESS_EVENTS.JOB_COMPLETED,
|
|
203
|
-
expect.objectContaining({ jobId: 'job-1', jobType: 'import', tenantId: baseCtx.tenantId })
|
|
204
|
-
)
|
|
205
|
-
})
|
|
206
|
-
|
|
207
|
-
it('failJob — sets failed status, records error, emits JOB_FAILED', async () => {
|
|
208
|
-
const em = buildEm()
|
|
209
|
-
const eventBus = { emit: jest.fn().mockResolvedValue(undefined) }
|
|
210
|
-
|
|
211
|
-
const job = {
|
|
212
|
-
id: 'job-1',
|
|
213
|
-
jobType: 'import',
|
|
214
|
-
status: 'running',
|
|
215
|
-
tenantId: baseCtx.tenantId,
|
|
216
|
-
} as unknown as ProgressJob
|
|
217
|
-
em.findOne.mockResolvedValue(job)
|
|
218
|
-
|
|
219
|
-
const service = createProgressService(em as never, eventBus)
|
|
220
|
-
const result = await service.failJob('job-1', { errorMessage: 'Network error', errorStack: 'stack...' }, baseCtx)
|
|
221
|
-
|
|
222
|
-
expect(result.status).toBe('failed')
|
|
223
|
-
expect(result.finishedAt).toBeInstanceOf(Date)
|
|
224
|
-
expect(result.errorMessage).toBe('Network error')
|
|
225
|
-
expect(result.errorStack).toBe('stack...')
|
|
226
|
-
expect(em.flush).toHaveBeenCalled()
|
|
227
|
-
expect(em.findOne).toHaveBeenCalledWith(
|
|
228
|
-
expect.anything(),
|
|
229
|
-
expect.objectContaining({ id: 'job-1', tenantId: baseCtx.tenantId })
|
|
230
|
-
)
|
|
231
|
-
expect(eventBus.emit).toHaveBeenCalledWith(
|
|
232
|
-
PROGRESS_EVENTS.JOB_FAILED,
|
|
233
|
-
expect.objectContaining({ jobId: 'job-1', errorMessage: 'Network error', tenantId: baseCtx.tenantId })
|
|
234
|
-
)
|
|
235
|
-
})
|
|
236
|
-
|
|
237
|
-
it('cancelJob (pending) — sets cancelled status immediately', async () => {
|
|
238
|
-
const em = buildEm()
|
|
239
|
-
const eventBus = { emit: jest.fn().mockResolvedValue(undefined) }
|
|
240
|
-
|
|
241
|
-
const job = {
|
|
242
|
-
id: 'job-1',
|
|
243
|
-
jobType: 'import',
|
|
244
|
-
status: 'pending',
|
|
245
|
-
cancellable: true,
|
|
246
|
-
} as unknown as ProgressJob
|
|
247
|
-
em.findOneOrFail.mockResolvedValue(job)
|
|
248
|
-
|
|
249
|
-
const service = createProgressService(em as never, eventBus)
|
|
250
|
-
const result = await service.cancelJob('job-1', baseCtx)
|
|
251
|
-
|
|
252
|
-
expect(result.status).toBe('cancelled')
|
|
253
|
-
expect(result.finishedAt).toBeInstanceOf(Date)
|
|
254
|
-
expect(result.cancelRequestedAt).toBeInstanceOf(Date)
|
|
255
|
-
expect(result.cancelledByUserId).toBe(baseCtx.userId)
|
|
256
|
-
expect(em.flush).toHaveBeenCalled()
|
|
257
|
-
expect(eventBus.emit).toHaveBeenCalledWith(
|
|
258
|
-
PROGRESS_EVENTS.JOB_CANCELLED,
|
|
259
|
-
expect.objectContaining({ jobId: 'job-1', tenantId: baseCtx.tenantId })
|
|
260
|
-
)
|
|
261
|
-
})
|
|
262
|
-
|
|
263
|
-
it('cancelJob (running) — sets cancelRequestedAt but keeps running status', async () => {
|
|
264
|
-
const em = buildEm()
|
|
265
|
-
const eventBus = { emit: jest.fn().mockResolvedValue(undefined) }
|
|
266
|
-
|
|
267
|
-
const job = {
|
|
268
|
-
id: 'job-1',
|
|
269
|
-
jobType: 'import',
|
|
270
|
-
status: 'running',
|
|
271
|
-
cancellable: true,
|
|
272
|
-
} as unknown as ProgressJob
|
|
273
|
-
em.findOneOrFail.mockResolvedValue(job)
|
|
274
|
-
|
|
275
|
-
const service = createProgressService(em as never, eventBus)
|
|
276
|
-
const result = await service.cancelJob('job-1', baseCtx)
|
|
277
|
-
|
|
278
|
-
expect(result.status).toBe('running')
|
|
279
|
-
expect(result.cancelRequestedAt).toBeInstanceOf(Date)
|
|
280
|
-
expect(result.cancelledByUserId).toBe(baseCtx.userId)
|
|
281
|
-
expect(result.finishedAt).toBeUndefined()
|
|
282
|
-
expect(eventBus.emit).toHaveBeenCalledWith(
|
|
283
|
-
PROGRESS_EVENTS.JOB_CANCELLED,
|
|
284
|
-
expect.objectContaining({ jobId: 'job-1' })
|
|
285
|
-
)
|
|
286
|
-
})
|
|
287
|
-
|
|
288
|
-
it('markStaleJobsFailed — marks stale jobs as failed, emits per job', async () => {
|
|
289
|
-
const em = buildEm()
|
|
290
|
-
const eventBus = { emit: jest.fn().mockResolvedValue(undefined) }
|
|
291
|
-
|
|
292
|
-
const staleJob1 = { id: 'stale-1', jobType: 'export', status: 'running', tenantId: baseCtx.tenantId } as unknown as ProgressJob
|
|
293
|
-
const staleJob2 = { id: 'stale-2', jobType: 'import', status: 'running', tenantId: baseCtx.tenantId } as unknown as ProgressJob
|
|
294
|
-
em.find.mockResolvedValue([staleJob1, staleJob2])
|
|
295
|
-
|
|
296
|
-
const service = createProgressService(em as never, eventBus)
|
|
297
|
-
const count = await service.markStaleJobsFailed(baseCtx.tenantId, 60)
|
|
298
|
-
|
|
299
|
-
expect(count).toBe(2)
|
|
300
|
-
expect(staleJob1.status).toBe('failed')
|
|
301
|
-
expect(staleJob1.finishedAt).toBeInstanceOf(Date)
|
|
302
|
-
expect(staleJob1.errorMessage).toContain('no heartbeat for 60 seconds')
|
|
303
|
-
expect(staleJob2.status).toBe('failed')
|
|
304
|
-
expect(em.flush).toHaveBeenCalled()
|
|
305
|
-
expect(em.find).toHaveBeenCalledWith(
|
|
306
|
-
expect.anything(),
|
|
307
|
-
expect.objectContaining({ tenantId: baseCtx.tenantId })
|
|
308
|
-
)
|
|
309
|
-
expect(eventBus.emit).toHaveBeenCalledTimes(2)
|
|
310
|
-
expect(eventBus.emit).toHaveBeenCalledWith(
|
|
311
|
-
PROGRESS_EVENTS.JOB_FAILED,
|
|
312
|
-
expect.objectContaining({ jobId: 'stale-1', stale: true })
|
|
313
|
-
)
|
|
314
|
-
expect(eventBus.emit).toHaveBeenCalledWith(
|
|
315
|
-
PROGRESS_EVENTS.JOB_FAILED,
|
|
316
|
-
expect.objectContaining({ jobId: 'stale-2', stale: true })
|
|
317
|
-
)
|
|
318
|
-
})
|
|
319
|
-
|
|
320
|
-
it('getRecentlyCompletedJobs — queries completed/failed jobs with tenant scope', async () => {
|
|
321
|
-
const em = buildEm()
|
|
322
|
-
const eventBus = { emit: jest.fn().mockResolvedValue(undefined) }
|
|
323
|
-
|
|
324
|
-
const completedJob = { id: 'done-1', status: 'completed', tenantId: baseCtx.tenantId } as unknown as ProgressJob
|
|
325
|
-
em.find.mockResolvedValue([completedJob])
|
|
326
|
-
|
|
327
|
-
const service = createProgressService(em as never, eventBus)
|
|
328
|
-
const result = await service.getRecentlyCompletedJobs(baseCtx)
|
|
329
|
-
|
|
330
|
-
expect(result).toEqual([completedJob])
|
|
331
|
-
expect(em.find).toHaveBeenCalledWith(
|
|
332
|
-
expect.anything(),
|
|
333
|
-
expect.objectContaining({
|
|
334
|
-
tenantId: baseCtx.tenantId,
|
|
335
|
-
status: { $in: ['completed', 'failed'] },
|
|
336
|
-
parentJobId: null,
|
|
337
|
-
}),
|
|
338
|
-
expect.objectContaining({ orderBy: { finishedAt: 'DESC' }, limit: 10 })
|
|
339
|
-
)
|
|
340
|
-
})
|
|
341
|
-
})
|
|
342
|
-
|
|
343
|
-
describe('calculateProgressPercent', () => {
|
|
344
|
-
it('returns correct percentage', () => {
|
|
345
|
-
expect(calculateProgressPercent(50, 100)).toBe(50)
|
|
346
|
-
expect(calculateProgressPercent(1, 3)).toBe(33)
|
|
347
|
-
expect(calculateProgressPercent(2, 3)).toBe(67)
|
|
348
|
-
})
|
|
349
|
-
|
|
350
|
-
it('clamps at 100', () => {
|
|
351
|
-
expect(calculateProgressPercent(150, 100)).toBe(100)
|
|
352
|
-
})
|
|
353
|
-
|
|
354
|
-
it('returns 0 for null or zero totalCount', () => {
|
|
355
|
-
expect(calculateProgressPercent(50, null)).toBe(0)
|
|
356
|
-
expect(calculateProgressPercent(50, 0)).toBe(0)
|
|
357
|
-
})
|
|
358
|
-
})
|
|
359
|
-
|
|
360
|
-
describe('calculateEta', () => {
|
|
361
|
-
it('returns null when processedCount is zero', () => {
|
|
362
|
-
expect(calculateEta(0, 100, new Date())).toBeNull()
|
|
363
|
-
})
|
|
364
|
-
|
|
365
|
-
it('returns null when totalCount is zero', () => {
|
|
366
|
-
expect(calculateEta(50, 0, new Date())).toBeNull()
|
|
367
|
-
})
|
|
368
|
-
|
|
369
|
-
it('calculates remaining seconds correctly', () => {
|
|
370
|
-
const startedAt = new Date(Date.now() - 10_000)
|
|
371
|
-
const eta = calculateEta(50, 100, startedAt)
|
|
372
|
-
|
|
373
|
-
expect(eta).not.toBeNull()
|
|
374
|
-
expect(eta!).toBeGreaterThan(0)
|
|
375
|
-
expect(eta!).toBeLessThanOrEqual(11)
|
|
376
|
-
})
|
|
377
|
-
})
|