@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.
Files changed (473) hide show
  1. package/package.json +2 -2
  2. package/dist/modules/auth/__integration__/TC-AUTH-001.spec.js +0 -9
  3. package/dist/modules/auth/__integration__/TC-AUTH-001.spec.js.map +0 -7
  4. package/dist/modules/auth/__integration__/TC-AUTH-002.spec.js +0 -22
  5. package/dist/modules/auth/__integration__/TC-AUTH-002.spec.js.map +0 -7
  6. package/dist/modules/auth/__integration__/TC-AUTH-003.spec.js +0 -21
  7. package/dist/modules/auth/__integration__/TC-AUTH-003.spec.js.map +0 -7
  8. package/dist/modules/auth/__integration__/TC-AUTH-004.spec.js +0 -15
  9. package/dist/modules/auth/__integration__/TC-AUTH-004.spec.js.map +0 -7
  10. package/dist/modules/auth/__integration__/TC-AUTH-005.spec.js +0 -11
  11. package/dist/modules/auth/__integration__/TC-AUTH-005.spec.js.map +0 -7
  12. package/dist/modules/auth/__integration__/TC-AUTH-006.spec.js +0 -11
  13. package/dist/modules/auth/__integration__/TC-AUTH-006.spec.js.map +0 -7
  14. package/dist/modules/auth/__integration__/TC-AUTH-007.spec.js +0 -14
  15. package/dist/modules/auth/__integration__/TC-AUTH-007.spec.js.map +0 -7
  16. package/dist/modules/auth/__integration__/TC-AUTH-008.spec.js +0 -26
  17. package/dist/modules/auth/__integration__/TC-AUTH-008.spec.js.map +0 -7
  18. package/dist/modules/auth/__integration__/TC-AUTH-009.spec.js +0 -16
  19. package/dist/modules/auth/__integration__/TC-AUTH-009.spec.js.map +0 -7
  20. package/dist/modules/auth/__integration__/TC-AUTH-010.spec.js +0 -32
  21. package/dist/modules/auth/__integration__/TC-AUTH-010.spec.js.map +0 -7
  22. package/dist/modules/auth/__integration__/TC-AUTH-011.spec.js +0 -26
  23. package/dist/modules/auth/__integration__/TC-AUTH-011.spec.js.map +0 -7
  24. package/dist/modules/auth/__integration__/TC-AUTH-012.spec.js +0 -30
  25. package/dist/modules/auth/__integration__/TC-AUTH-012.spec.js.map +0 -7
  26. package/dist/modules/auth/__integration__/TC-AUTH-013.spec.js +0 -41
  27. package/dist/modules/auth/__integration__/TC-AUTH-013.spec.js.map +0 -7
  28. package/dist/modules/auth/__integration__/TC-AUTH-014.spec.js +0 -25
  29. package/dist/modules/auth/__integration__/TC-AUTH-014.spec.js.map +0 -7
  30. package/dist/modules/auth/__integration__/TC-AUTH-015.spec.js +0 -20
  31. package/dist/modules/auth/__integration__/TC-AUTH-015.spec.js.map +0 -7
  32. package/dist/modules/auth/__integration__/TC-AUTH-016.spec.js +0 -76
  33. package/dist/modules/auth/__integration__/TC-AUTH-016.spec.js.map +0 -7
  34. package/dist/modules/catalog/__integration__/TC-CAT-001.spec.js +0 -20
  35. package/dist/modules/catalog/__integration__/TC-CAT-001.spec.js.map +0 -7
  36. package/dist/modules/catalog/__integration__/TC-CAT-002.spec.js +0 -12
  37. package/dist/modules/catalog/__integration__/TC-CAT-002.spec.js.map +0 -7
  38. package/dist/modules/catalog/__integration__/TC-CAT-003.spec.js +0 -28
  39. package/dist/modules/catalog/__integration__/TC-CAT-003.spec.js.map +0 -7
  40. package/dist/modules/catalog/__integration__/TC-CAT-004.spec.js +0 -33
  41. package/dist/modules/catalog/__integration__/TC-CAT-004.spec.js.map +0 -7
  42. package/dist/modules/catalog/__integration__/TC-CAT-005.spec.js +0 -30
  43. package/dist/modules/catalog/__integration__/TC-CAT-005.spec.js.map +0 -7
  44. package/dist/modules/catalog/__integration__/TC-CAT-006.spec.js +0 -31
  45. package/dist/modules/catalog/__integration__/TC-CAT-006.spec.js.map +0 -7
  46. package/dist/modules/catalog/__integration__/TC-CAT-007.spec.js +0 -31
  47. package/dist/modules/catalog/__integration__/TC-CAT-007.spec.js.map +0 -7
  48. package/dist/modules/catalog/__integration__/TC-CAT-008.spec.js +0 -65
  49. package/dist/modules/catalog/__integration__/TC-CAT-008.spec.js.map +0 -7
  50. package/dist/modules/catalog/__integration__/TC-CAT-009.spec.js +0 -31
  51. package/dist/modules/catalog/__integration__/TC-CAT-009.spec.js.map +0 -7
  52. package/dist/modules/catalog/__integration__/TC-CAT-010.spec.js +0 -28
  53. package/dist/modules/catalog/__integration__/TC-CAT-010.spec.js.map +0 -7
  54. package/dist/modules/catalog/__integration__/TC-CAT-011.spec.js +0 -34
  55. package/dist/modules/catalog/__integration__/TC-CAT-011.spec.js.map +0 -7
  56. package/dist/modules/catalog/__integration__/TC-CAT-012.spec.js +0 -27
  57. package/dist/modules/catalog/__integration__/TC-CAT-012.spec.js.map +0 -7
  58. package/dist/modules/core/__integration__/admin/TC-ADMIN-001.spec.js +0 -44
  59. package/dist/modules/core/__integration__/admin/TC-ADMIN-001.spec.js.map +0 -7
  60. package/dist/modules/core/__integration__/admin/TC-ADMIN-002.spec.js +0 -53
  61. package/dist/modules/core/__integration__/admin/TC-ADMIN-002.spec.js.map +0 -7
  62. package/dist/modules/core/__integration__/admin/TC-ADMIN-003.spec.js +0 -26
  63. package/dist/modules/core/__integration__/admin/TC-ADMIN-003.spec.js.map +0 -7
  64. package/dist/modules/core/__integration__/admin/TC-ADMIN-004.spec.js +0 -47
  65. package/dist/modules/core/__integration__/admin/TC-ADMIN-004.spec.js.map +0 -7
  66. package/dist/modules/core/__integration__/admin/TC-ADMIN-005.spec.js +0 -33
  67. package/dist/modules/core/__integration__/admin/TC-ADMIN-005.spec.js.map +0 -7
  68. package/dist/modules/core/__integration__/admin/TC-ADMIN-006.spec.js +0 -30
  69. package/dist/modules/core/__integration__/admin/TC-ADMIN-006.spec.js.map +0 -7
  70. package/dist/modules/core/__integration__/admin/TC-ADMIN-007.spec.js +0 -36
  71. package/dist/modules/core/__integration__/admin/TC-ADMIN-007.spec.js.map +0 -7
  72. package/dist/modules/core/__integration__/admin/TC-ADMIN-008.spec.js +0 -113
  73. package/dist/modules/core/__integration__/admin/TC-ADMIN-008.spec.js.map +0 -7
  74. package/dist/modules/core/__integration__/admin/TC-ADMIN-009.spec.js +0 -25
  75. package/dist/modules/core/__integration__/admin/TC-ADMIN-009.spec.js.map +0 -7
  76. package/dist/modules/core/__integration__/admin/TC-ADMIN-010.spec.js +0 -35
  77. package/dist/modules/core/__integration__/admin/TC-ADMIN-010.spec.js.map +0 -7
  78. package/dist/modules/core/__integration__/helpers/api.js +0 -64
  79. package/dist/modules/core/__integration__/helpers/api.js.map +0 -7
  80. package/dist/modules/core/__integration__/helpers/auth.js +0 -98
  81. package/dist/modules/core/__integration__/helpers/auth.js.map +0 -7
  82. package/dist/modules/core/__integration__/helpers/authUi.js +0 -31
  83. package/dist/modules/core/__integration__/helpers/authUi.js.map +0 -7
  84. package/dist/modules/core/__integration__/helpers/catalogFixtures.js +0 -49
  85. package/dist/modules/core/__integration__/helpers/catalogFixtures.js.map +0 -7
  86. package/dist/modules/core/__integration__/helpers/crmFixtures.js +0 -73
  87. package/dist/modules/core/__integration__/helpers/crmFixtures.js.map +0 -7
  88. package/dist/modules/core/__integration__/helpers/salesFixtures.js +0 -63
  89. package/dist/modules/core/__integration__/helpers/salesFixtures.js.map +0 -7
  90. package/dist/modules/core/__integration__/helpers/salesUi.js +0 -464
  91. package/dist/modules/core/__integration__/helpers/salesUi.js.map +0 -7
  92. package/dist/modules/core/__integration__/integration/TC-INT-001.spec.js +0 -26
  93. package/dist/modules/core/__integration__/integration/TC-INT-001.spec.js.map +0 -7
  94. package/dist/modules/core/__integration__/integration/TC-INT-002.spec.js +0 -60
  95. package/dist/modules/core/__integration__/integration/TC-INT-002.spec.js.map +0 -7
  96. package/dist/modules/core/__integration__/integration/TC-INT-003.spec.js +0 -36
  97. package/dist/modules/core/__integration__/integration/TC-INT-003.spec.js.map +0 -7
  98. package/dist/modules/core/__integration__/integration/TC-INT-004.spec.js +0 -74
  99. package/dist/modules/core/__integration__/integration/TC-INT-004.spec.js.map +0 -7
  100. package/dist/modules/core/__integration__/integration/TC-INT-005.spec.js +0 -21
  101. package/dist/modules/core/__integration__/integration/TC-INT-005.spec.js.map +0 -7
  102. package/dist/modules/customers/__integration__/TC-CRM-001.spec.js +0 -32
  103. package/dist/modules/customers/__integration__/TC-CRM-001.spec.js.map +0 -7
  104. package/dist/modules/customers/__integration__/TC-CRM-002.spec.js +0 -35
  105. package/dist/modules/customers/__integration__/TC-CRM-002.spec.js.map +0 -7
  106. package/dist/modules/customers/__integration__/TC-CRM-003.spec.js +0 -40
  107. package/dist/modules/customers/__integration__/TC-CRM-003.spec.js.map +0 -7
  108. package/dist/modules/customers/__integration__/TC-CRM-004.spec.js +0 -40
  109. package/dist/modules/customers/__integration__/TC-CRM-004.spec.js.map +0 -7
  110. package/dist/modules/customers/__integration__/TC-CRM-005.spec.js +0 -37
  111. package/dist/modules/customers/__integration__/TC-CRM-005.spec.js.map +0 -7
  112. package/dist/modules/customers/__integration__/TC-CRM-006.spec.js +0 -42
  113. package/dist/modules/customers/__integration__/TC-CRM-006.spec.js.map +0 -7
  114. package/dist/modules/customers/__integration__/TC-CRM-007.spec.js +0 -44
  115. package/dist/modules/customers/__integration__/TC-CRM-007.spec.js.map +0 -7
  116. package/dist/modules/customers/__integration__/TC-CRM-008.spec.js +0 -50
  117. package/dist/modules/customers/__integration__/TC-CRM-008.spec.js.map +0 -7
  118. package/dist/modules/customers/__integration__/TC-CRM-009.spec.js +0 -33
  119. package/dist/modules/customers/__integration__/TC-CRM-009.spec.js.map +0 -7
  120. package/dist/modules/customers/__integration__/TC-CRM-010.spec.js +0 -39
  121. package/dist/modules/customers/__integration__/TC-CRM-010.spec.js.map +0 -7
  122. package/dist/modules/customers/__integration__/TC-CRM-011.spec.js +0 -37
  123. package/dist/modules/customers/__integration__/TC-CRM-011.spec.js.map +0 -7
  124. package/dist/modules/customers/__integration__/TC-CRM-012.spec.js +0 -38
  125. package/dist/modules/customers/__integration__/TC-CRM-012.spec.js.map +0 -7
  126. package/dist/modules/customers/__integration__/TC-CRM-013.spec.js +0 -43
  127. package/dist/modules/customers/__integration__/TC-CRM-013.spec.js.map +0 -7
  128. package/dist/modules/customers/__integration__/TC-CRM-014.spec.js +0 -23
  129. package/dist/modules/customers/__integration__/TC-CRM-014.spec.js.map +0 -7
  130. package/dist/modules/customers/__integration__/TC-CRM-015.spec.js +0 -63
  131. package/dist/modules/customers/__integration__/TC-CRM-015.spec.js.map +0 -7
  132. package/dist/modules/customers/__integration__/TC-CRM-016.spec.js +0 -46
  133. package/dist/modules/customers/__integration__/TC-CRM-016.spec.js.map +0 -7
  134. package/dist/modules/customers/__integration__/TC-CRM-017.spec.js +0 -29
  135. package/dist/modules/customers/__integration__/TC-CRM-017.spec.js.map +0 -7
  136. package/dist/modules/customers/__integration__/TC-CRM-018.spec.js +0 -52
  137. package/dist/modules/customers/__integration__/TC-CRM-018.spec.js.map +0 -7
  138. package/dist/modules/customers/__integration__/TC-CRM-019.spec.js +0 -37
  139. package/dist/modules/customers/__integration__/TC-CRM-019.spec.js.map +0 -7
  140. package/dist/modules/customers/__integration__/TC-CRM-020.spec.js +0 -65
  141. package/dist/modules/customers/__integration__/TC-CRM-020.spec.js.map +0 -7
  142. package/dist/modules/progress/__integration__/TC-PROG-001.spec.js +0 -51
  143. package/dist/modules/progress/__integration__/TC-PROG-001.spec.js.map +0 -7
  144. package/dist/modules/resources/__integration__/TC-INT-007.spec.js +0 -88
  145. package/dist/modules/resources/__integration__/TC-INT-007.spec.js.map +0 -7
  146. package/dist/modules/resources/__integration__/helpers/resourcesFixtures.js +0 -45
  147. package/dist/modules/resources/__integration__/helpers/resourcesFixtures.js.map +0 -7
  148. package/dist/modules/sales/__integration__/TC-SALES-001.spec.js +0 -20
  149. package/dist/modules/sales/__integration__/TC-SALES-001.spec.js.map +0 -7
  150. package/dist/modules/sales/__integration__/TC-SALES-002.spec.js +0 -31
  151. package/dist/modules/sales/__integration__/TC-SALES-002.spec.js.map +0 -7
  152. package/dist/modules/sales/__integration__/TC-SALES-003.spec.js +0 -13
  153. package/dist/modules/sales/__integration__/TC-SALES-003.spec.js.map +0 -7
  154. package/dist/modules/sales/__integration__/TC-SALES-004.spec.js +0 -14
  155. package/dist/modules/sales/__integration__/TC-SALES-004.spec.js.map +0 -7
  156. package/dist/modules/sales/__integration__/TC-SALES-005.spec.js +0 -15
  157. package/dist/modules/sales/__integration__/TC-SALES-005.spec.js.map +0 -7
  158. package/dist/modules/sales/__integration__/TC-SALES-006.spec.js +0 -20
  159. package/dist/modules/sales/__integration__/TC-SALES-006.spec.js.map +0 -7
  160. package/dist/modules/sales/__integration__/TC-SALES-007.spec.js +0 -19
  161. package/dist/modules/sales/__integration__/TC-SALES-007.spec.js.map +0 -7
  162. package/dist/modules/sales/__integration__/TC-SALES-008.spec.js +0 -7
  163. package/dist/modules/sales/__integration__/TC-SALES-008.spec.js.map +0 -7
  164. package/dist/modules/sales/__integration__/TC-SALES-009.spec.js +0 -7
  165. package/dist/modules/sales/__integration__/TC-SALES-009.spec.js.map +0 -7
  166. package/dist/modules/sales/__integration__/TC-SALES-010.spec.js +0 -16
  167. package/dist/modules/sales/__integration__/TC-SALES-010.spec.js.map +0 -7
  168. package/dist/modules/sales/__integration__/TC-SALES-011.spec.js +0 -20
  169. package/dist/modules/sales/__integration__/TC-SALES-011.spec.js.map +0 -7
  170. package/dist/modules/sales/__integration__/TC-SALES-012.spec.js +0 -7
  171. package/dist/modules/sales/__integration__/TC-SALES-012.spec.js.map +0 -7
  172. package/dist/modules/sales/__integration__/TC-SALES-013.spec.js +0 -66
  173. package/dist/modules/sales/__integration__/TC-SALES-013.spec.js.map +0 -7
  174. package/dist/modules/sales/__integration__/TC-SALES-014.spec.js +0 -13
  175. package/dist/modules/sales/__integration__/TC-SALES-014.spec.js.map +0 -7
  176. package/dist/modules/sales/__integration__/TC-SALES-015.spec.js +0 -13
  177. package/dist/modules/sales/__integration__/TC-SALES-015.spec.js.map +0 -7
  178. package/dist/modules/sales/__integration__/TC-SALES-016.spec.js +0 -13
  179. package/dist/modules/sales/__integration__/TC-SALES-016.spec.js.map +0 -7
  180. package/dist/modules/sales/__integration__/TC-SALES-017.spec.js +0 -44
  181. package/dist/modules/sales/__integration__/TC-SALES-017.spec.js.map +0 -7
  182. package/dist/modules/sales/__integration__/TC-SALES-018.spec.js +0 -18
  183. package/dist/modules/sales/__integration__/TC-SALES-018.spec.js.map +0 -7
  184. package/dist/modules/sales/__integration__/TC-SALES-019.spec.js +0 -16
  185. package/dist/modules/sales/__integration__/TC-SALES-019.spec.js.map +0 -7
  186. package/dist/modules/sales/__integration__/TC-SALES-020.spec.js +0 -75
  187. package/dist/modules/sales/__integration__/TC-SALES-020.spec.js.map +0 -7
  188. package/dist/modules/staff/__integration__/TC-INT-006.spec.js +0 -64
  189. package/dist/modules/staff/__integration__/TC-INT-006.spec.js.map +0 -7
  190. package/dist/modules/translations/__integration__/TC-TRANS-001.spec.js +0 -48
  191. package/dist/modules/translations/__integration__/TC-TRANS-001.spec.js.map +0 -7
  192. package/dist/modules/translations/__integration__/TC-TRANS-002.spec.js +0 -94
  193. package/dist/modules/translations/__integration__/TC-TRANS-002.spec.js.map +0 -7
  194. package/dist/modules/translations/__integration__/TC-TRANS-003.spec.js +0 -61
  195. package/dist/modules/translations/__integration__/TC-TRANS-003.spec.js.map +0 -7
  196. package/dist/modules/translations/__integration__/TC-TRANS-004.spec.js +0 -52
  197. package/dist/modules/translations/__integration__/TC-TRANS-004.spec.js.map +0 -7
  198. package/dist/modules/translations/__integration__/TC-TRANS-005.spec.js +0 -106
  199. package/dist/modules/translations/__integration__/TC-TRANS-005.spec.js.map +0 -7
  200. package/dist/modules/translations/__integration__/TC-TRANS-006.spec.js +0 -94
  201. package/dist/modules/translations/__integration__/TC-TRANS-006.spec.js.map +0 -7
  202. package/dist/modules/translations/__integration__/TC-TRANS-007.spec.js +0 -62
  203. package/dist/modules/translations/__integration__/TC-TRANS-007.spec.js.map +0 -7
  204. package/dist/modules/translations/__integration__/TC-TRANS-008.spec.js +0 -168
  205. package/dist/modules/translations/__integration__/TC-TRANS-008.spec.js.map +0 -7
  206. package/dist/modules/translations/__integration__/helpers/translationFixtures.js +0 -63
  207. package/dist/modules/translations/__integration__/helpers/translationFixtures.js.map +0 -7
  208. package/dist/modules/workflows/__integration__/TC-WF-001.spec.js +0 -73
  209. package/dist/modules/workflows/__integration__/TC-WF-001.spec.js.map +0 -7
  210. package/src/__tests__/module-decoupling.test.ts +0 -356
  211. package/src/modules/api_keys/api/__tests__/keys.route.test.ts +0 -244
  212. package/src/modules/attachments/api/__tests__/attachments.api.test.ts +0 -240
  213. package/src/modules/attachments/components/__tests__/AttachmentContentPreview.test.tsx +0 -45
  214. package/src/modules/attachments/data/__tests__/entities-ocr.test.ts +0 -15
  215. package/src/modules/attachments/lib/__tests__/ocr-config.test.ts +0 -27
  216. package/src/modules/attachments/lib/__tests__/textExtraction.test.ts +0 -64
  217. package/src/modules/audit_logs/api/__tests__/access.route.test.ts +0 -118
  218. package/src/modules/audit_logs/api/__tests__/redo.route.test.ts +0 -131
  219. package/src/modules/audit_logs/api/__tests__/undo.route.test.ts +0 -103
  220. package/src/modules/audit_logs/services/__tests__/actionLogService.test.ts +0 -26
  221. package/src/modules/auth/__integration__/TC-AUTH-001.spec.ts +0 -13
  222. package/src/modules/auth/__integration__/TC-AUTH-002.spec.ts +0 -30
  223. package/src/modules/auth/__integration__/TC-AUTH-003.spec.ts +0 -28
  224. package/src/modules/auth/__integration__/TC-AUTH-004.spec.ts +0 -21
  225. package/src/modules/auth/__integration__/TC-AUTH-005.spec.ts +0 -17
  226. package/src/modules/auth/__integration__/TC-AUTH-006.spec.ts +0 -17
  227. package/src/modules/auth/__integration__/TC-AUTH-007.spec.ts +0 -19
  228. package/src/modules/auth/__integration__/TC-AUTH-008.spec.ts +0 -31
  229. package/src/modules/auth/__integration__/TC-AUTH-009.spec.ts +0 -22
  230. package/src/modules/auth/__integration__/TC-AUTH-010.spec.ts +0 -39
  231. package/src/modules/auth/__integration__/TC-AUTH-011.spec.ts +0 -35
  232. package/src/modules/auth/__integration__/TC-AUTH-012.spec.ts +0 -36
  233. package/src/modules/auth/__integration__/TC-AUTH-013.spec.ts +0 -48
  234. package/src/modules/auth/__integration__/TC-AUTH-014.spec.ts +0 -31
  235. package/src/modules/auth/__integration__/TC-AUTH-015.spec.ts +0 -28
  236. package/src/modules/auth/__integration__/TC-AUTH-016.spec.ts +0 -109
  237. package/src/modules/auth/__tests__/cli-rotate-encryption.test.ts +0 -97
  238. package/src/modules/auth/__tests__/cli-setup-acl.test.ts +0 -148
  239. package/src/modules/auth/api/__tests__/feature-check.test.ts +0 -65
  240. package/src/modules/auth/api/__tests__/login.test.ts +0 -47
  241. package/src/modules/auth/commands/__tests__/roles.custom-fields.test.ts +0 -126
  242. package/src/modules/auth/commands/__tests__/users.custom-fields.test.ts +0 -147
  243. package/src/modules/auth/lib/__tests__/rateLimitCheck.test.ts +0 -224
  244. package/src/modules/auth/services/__tests__/authService.test.ts +0 -32
  245. package/src/modules/auth/services/__tests__/rbacService.test.ts +0 -814
  246. package/src/modules/business_rules/api/__tests__/execute.route.test.ts +0 -311
  247. package/src/modules/business_rules/api/__tests__/logs-detail.route.test.ts +0 -181
  248. package/src/modules/business_rules/api/__tests__/logs.route.test.ts +0 -261
  249. package/src/modules/business_rules/api/__tests__/rules-detail.route.test.ts +0 -115
  250. package/src/modules/business_rules/api/__tests__/rules.route.test.ts +0 -746
  251. package/src/modules/business_rules/api/__tests__/sets-detail.route.test.ts +0 -169
  252. package/src/modules/business_rules/api/__tests__/sets-members.route.test.ts +0 -367
  253. package/src/modules/business_rules/api/__tests__/sets.route.test.ts +0 -361
  254. package/src/modules/business_rules/api/__tests__/test-helpers.ts +0 -42
  255. package/src/modules/business_rules/components/utils/__tests__/formHelpers.test.ts +0 -69
  256. package/src/modules/business_rules/data/__tests__/validators.test.ts +0 -637
  257. package/src/modules/business_rules/lib/__tests__/action-executor.test.ts +0 -728
  258. package/src/modules/business_rules/lib/__tests__/expression-evaluator.test.ts +0 -592
  259. package/src/modules/business_rules/lib/__tests__/rule-engine.test.ts +0 -805
  260. package/src/modules/business_rules/lib/__tests__/rule-evaluator.test.ts +0 -436
  261. package/src/modules/catalog/__integration__/TC-CAT-001.spec.ts +0 -32
  262. package/src/modules/catalog/__integration__/TC-CAT-002.spec.ts +0 -19
  263. package/src/modules/catalog/__integration__/TC-CAT-003.spec.ts +0 -39
  264. package/src/modules/catalog/__integration__/TC-CAT-004.spec.ts +0 -41
  265. package/src/modules/catalog/__integration__/TC-CAT-005.spec.ts +0 -37
  266. package/src/modules/catalog/__integration__/TC-CAT-006.spec.ts +0 -40
  267. package/src/modules/catalog/__integration__/TC-CAT-007.spec.ts +0 -37
  268. package/src/modules/catalog/__integration__/TC-CAT-008.spec.ts +0 -76
  269. package/src/modules/catalog/__integration__/TC-CAT-009.spec.ts +0 -39
  270. package/src/modules/catalog/__integration__/TC-CAT-010.spec.ts +0 -36
  271. package/src/modules/catalog/__integration__/TC-CAT-011.spec.ts +0 -44
  272. package/src/modules/catalog/__integration__/TC-CAT-012.spec.ts +0 -35
  273. package/src/modules/catalog/api/__tests__/offers.route.test.ts +0 -161
  274. package/src/modules/catalog/api/__tests__/prices.route.test.ts +0 -39
  275. package/src/modules/catalog/api/__tests__/products.route.test.ts +0 -91
  276. package/src/modules/catalog/api/__tests__/utils.test.ts +0 -36
  277. package/src/modules/catalog/api/__tests__/variants.route.test.ts +0 -44
  278. package/src/modules/catalog/backend/catalog/products/__tests__/ProductsDataTable.test.tsx +0 -172
  279. package/src/modules/catalog/commands/__tests__/products.delete.test.ts +0 -146
  280. package/src/modules/catalog/commands/__tests__/products.update.test.ts +0 -142
  281. package/src/modules/catalog/commands/__tests__/registration.test.ts +0 -54
  282. package/src/modules/catalog/commands/__tests__/shared.test.ts +0 -129
  283. package/src/modules/catalog/components/__tests__/catalogComponentsRender.test.tsx +0 -373
  284. package/src/modules/catalog/components/products/__tests__/ProductImageCell.test.tsx +0 -51
  285. package/src/modules/catalog/components/products/__tests__/productForm.test.ts +0 -32
  286. package/src/modules/catalog/lib/__tests__/pricing.test.ts +0 -150
  287. package/src/modules/catalog/services/__tests__/catalogPricingService.test.ts +0 -21
  288. package/src/modules/configs/components/__tests__/CachePanel.test.tsx +0 -134
  289. package/src/modules/configs/components/__tests__/SystemStatusPanel.test.tsx +0 -93
  290. package/src/modules/configs/lib/__tests__/system-status.test.ts +0 -55
  291. package/src/modules/configs/lib/__tests__/upgrade-actions.test.ts +0 -135
  292. package/src/modules/core/__integration__/admin/TC-ADMIN-001.spec.ts +0 -70
  293. package/src/modules/core/__integration__/admin/TC-ADMIN-002.spec.ts +0 -83
  294. package/src/modules/core/__integration__/admin/TC-ADMIN-003.spec.ts +0 -50
  295. package/src/modules/core/__integration__/admin/TC-ADMIN-004.spec.ts +0 -77
  296. package/src/modules/core/__integration__/admin/TC-ADMIN-005.spec.ts +0 -49
  297. package/src/modules/core/__integration__/admin/TC-ADMIN-006.spec.ts +0 -59
  298. package/src/modules/core/__integration__/admin/TC-ADMIN-007.spec.ts +0 -68
  299. package/src/modules/core/__integration__/admin/TC-ADMIN-008.spec.ts +0 -127
  300. package/src/modules/core/__integration__/admin/TC-ADMIN-009.spec.ts +0 -48
  301. package/src/modules/core/__integration__/admin/TC-ADMIN-010.spec.ts +0 -57
  302. package/src/modules/core/__integration__/helpers/api.ts +0 -84
  303. package/src/modules/core/__integration__/helpers/auth.ts +0 -110
  304. package/src/modules/core/__integration__/helpers/authUi.ts +0 -33
  305. package/src/modules/core/__integration__/helpers/catalogFixtures.ts +0 -73
  306. package/src/modules/core/__integration__/helpers/crmFixtures.ts +0 -101
  307. package/src/modules/core/__integration__/helpers/salesFixtures.ts +0 -89
  308. package/src/modules/core/__integration__/helpers/salesUi.ts +0 -528
  309. package/src/modules/core/__integration__/integration/TC-INT-001.spec.ts +0 -34
  310. package/src/modules/core/__integration__/integration/TC-INT-002.spec.ts +0 -74
  311. package/src/modules/core/__integration__/integration/TC-INT-003.spec.ts +0 -43
  312. package/src/modules/core/__integration__/integration/TC-INT-004.spec.ts +0 -82
  313. package/src/modules/core/__integration__/integration/TC-INT-005.spec.ts +0 -29
  314. package/src/modules/currencies/backend/exchange-rates/__tests__/formatDateTimeLocal.test.ts +0 -78
  315. package/src/modules/currencies/data/__tests__/validators.test.ts +0 -100
  316. package/src/modules/currencies/services/__tests__/exchangeRateService.test.ts +0 -666
  317. package/src/modules/currencies/services/__tests__/rateFetchingService.basic.test.ts +0 -398
  318. package/src/modules/currencies/services/__tests__/rateFetchingService.errors.test.ts +0 -296
  319. package/src/modules/currencies/services/__tests__/rateFetchingService.providers.test.ts +0 -350
  320. package/src/modules/currencies/services/__tests__/rateFetchingService.setup.ts +0 -188
  321. package/src/modules/customers/__integration__/TC-CRM-001.spec.ts +0 -42
  322. package/src/modules/customers/__integration__/TC-CRM-002.spec.ts +0 -47
  323. package/src/modules/customers/__integration__/TC-CRM-003.spec.ts +0 -55
  324. package/src/modules/customers/__integration__/TC-CRM-004.spec.ts +0 -57
  325. package/src/modules/customers/__integration__/TC-CRM-005.spec.ts +0 -50
  326. package/src/modules/customers/__integration__/TC-CRM-006.spec.ts +0 -60
  327. package/src/modules/customers/__integration__/TC-CRM-007.spec.ts +0 -57
  328. package/src/modules/customers/__integration__/TC-CRM-008.spec.ts +0 -62
  329. package/src/modules/customers/__integration__/TC-CRM-009.spec.ts +0 -46
  330. package/src/modules/customers/__integration__/TC-CRM-010.spec.ts +0 -49
  331. package/src/modules/customers/__integration__/TC-CRM-011.spec.ts +0 -47
  332. package/src/modules/customers/__integration__/TC-CRM-012.spec.ts +0 -49
  333. package/src/modules/customers/__integration__/TC-CRM-013.spec.ts +0 -61
  334. package/src/modules/customers/__integration__/TC-CRM-014.spec.ts +0 -31
  335. package/src/modules/customers/__integration__/TC-CRM-015.spec.ts +0 -89
  336. package/src/modules/customers/__integration__/TC-CRM-016.spec.ts +0 -55
  337. package/src/modules/customers/__integration__/TC-CRM-017.spec.ts +0 -37
  338. package/src/modules/customers/__integration__/TC-CRM-018.spec.ts +0 -62
  339. package/src/modules/customers/__integration__/TC-CRM-019.spec.ts +0 -44
  340. package/src/modules/customers/__integration__/TC-CRM-020.spec.ts +0 -73
  341. package/src/modules/customers/api/__tests__/utils.test.ts +0 -61
  342. package/src/modules/customers/api/dashboard/widgets/new-deals/__tests__/route.test.ts +0 -54
  343. package/src/modules/customers/commands/__tests__/shared.test.ts +0 -263
  344. package/src/modules/customers/commands/__tests__/undo.custom-fields.test.ts +0 -1184
  345. package/src/modules/customers/components/detail/__tests__/ActivityForm.validation.test.ts +0 -37
  346. package/src/modules/customers/components/detail/__tests__/DealForm.validation.test.ts +0 -45
  347. package/src/modules/customers/components/detail/__tests__/InlineEditors.test.tsx +0 -166
  348. package/src/modules/customers/components/detail/__tests__/TaskForm.submit.test.ts +0 -21
  349. package/src/modules/customers/components/detail/hooks/__tests__/useCustomerDictionary.test.ts +0 -97
  350. package/src/modules/customers/lib/__tests__/customFieldRouting.test.ts +0 -107
  351. package/src/modules/customers/utils/__tests__/addressFormat.test.ts +0 -105
  352. package/src/modules/customers/utils/__tests__/phoneDuplicates.test.ts +0 -98
  353. package/src/modules/dashboards/__tests__/widgets.test.ts +0 -70
  354. package/src/modules/dashboards/lib/__tests__/aggregations.test.ts +0 -328
  355. package/src/modules/dashboards/lib/__tests__/formatters.test.ts +0 -128
  356. package/src/modules/directory/backend/directory/organizations/__tests__/create-submit.test.ts +0 -46
  357. package/src/modules/directory/backend/directory/organizations/__tests__/edit-submit.test.ts +0 -49
  358. package/src/modules/directory/components/__tests__/OrganizationSelect.test.tsx +0 -71
  359. package/src/modules/directory/components/__tests__/TenantSelect.test.tsx +0 -75
  360. package/src/modules/entities/__tests__/cli-decrypt-database.test.ts +0 -534
  361. package/src/modules/entities/__tests__/cli-rotate-encryption.test.ts +0 -123
  362. package/src/modules/entities/api/__tests__/encryption.api.test.ts +0 -57
  363. package/src/modules/entities/api/__tests__/records.get.custom-entity.test.ts +0 -43
  364. package/src/modules/entities/api/__tests__/records.validation.test.ts +0 -53
  365. package/src/modules/entities/backend/entities/user/__tests__/create-entity-submit.test.ts +0 -47
  366. package/src/modules/entities/backend/entities/user/__tests__/records-submit.test.ts +0 -104
  367. package/src/modules/feature_toggles/commands/__tests__/global.test.ts +0 -325
  368. package/src/modules/feature_toggles/commands/__tests__/overrides.test.ts +0 -186
  369. package/src/modules/feature_toggles/lib/__tests__/feature-flag-check.test.ts +0 -365
  370. package/src/modules/feature_toggles/lib/__tests__/queries.test.ts +0 -130
  371. package/src/modules/inbox_ops/api/emails/[id]/reprocess/__tests__/route.test.ts +0 -194
  372. package/src/modules/inbox_ops/api/proposals/[id]/__tests__/route.test.ts +0 -124
  373. package/src/modules/inbox_ops/api/proposals/[id]/accept-all/__tests__/route.test.ts +0 -154
  374. package/src/modules/inbox_ops/api/proposals/[id]/actions/[actionId]/__tests__/route.test.ts +0 -200
  375. package/src/modules/inbox_ops/api/proposals/[id]/actions/[actionId]/accept/__tests__/route.test.ts +0 -261
  376. package/src/modules/inbox_ops/api/proposals/[id]/actions/[actionId]/reject/__tests__/route.test.ts +0 -201
  377. package/src/modules/inbox_ops/api/proposals/[id]/reject/__tests__/route.test.ts +0 -123
  378. package/src/modules/inbox_ops/api/proposals/[id]/replies/[replyId]/send/__tests__/route.test.ts +0 -232
  379. package/src/modules/inbox_ops/api/proposals/[id]/translate/__tests__/route.test.ts +0 -173
  380. package/src/modules/inbox_ops/api/proposals/__tests__/route.test.ts +0 -185
  381. package/src/modules/inbox_ops/api/webhook/__tests__/inbound.test.ts +0 -317
  382. package/src/modules/inbox_ops/data/__tests__/validators.test.ts +0 -463
  383. package/src/modules/inbox_ops/lib/__tests__/catalogLookup.test.ts +0 -143
  384. package/src/modules/inbox_ops/lib/__tests__/contactMatcher.test.ts +0 -158
  385. package/src/modules/inbox_ops/lib/__tests__/emailParser.test.ts +0 -191
  386. package/src/modules/inbox_ops/lib/__tests__/executionEngine.test.ts +0 -1419
  387. package/src/modules/inbox_ops/lib/__tests__/extractionPrompt.test.ts +0 -151
  388. package/src/modules/inbox_ops/lib/__tests__/priceValidator.test.ts +0 -259
  389. package/src/modules/inbox_ops/lib/__tests__/translationProvider.test.ts +0 -99
  390. package/src/modules/inbox_ops/subscribers/__tests__/extractionWorker.test.ts +0 -803
  391. package/src/modules/notifications/__tests__/deliver-notification.test.ts +0 -285
  392. package/src/modules/notifications/__tests__/deliveryStrategies.test.ts +0 -19
  393. package/src/modules/notifications/__tests__/notificationService.test.ts +0 -248
  394. package/src/modules/planner/__tests__/availabilityMerge.test.ts +0 -99
  395. package/src/modules/planner/__tests__/plannerAvailabilityService.test.ts +0 -89
  396. package/src/modules/planner/data/__tests__/validators.test.ts +0 -78
  397. package/src/modules/progress/__integration__/TC-PROG-001.spec.ts +0 -67
  398. package/src/modules/progress/__tests__/progressService.test.ts +0 -377
  399. package/src/modules/query_index/__tests__/hybrid-engine.test.ts +0 -365
  400. package/src/modules/query_index/__tests__/indexer.test.ts +0 -175
  401. package/src/modules/resources/__integration__/TC-INT-007.spec.ts +0 -110
  402. package/src/modules/resources/__integration__/helpers/resourcesFixtures.ts +0 -50
  403. package/src/modules/resources/data/__tests__/validators.test.ts +0 -65
  404. package/src/modules/sales/__integration__/TC-SALES-001.spec.ts +0 -26
  405. package/src/modules/sales/__integration__/TC-SALES-002.spec.ts +0 -38
  406. package/src/modules/sales/__integration__/TC-SALES-003.spec.ts +0 -18
  407. package/src/modules/sales/__integration__/TC-SALES-004.spec.ts +0 -19
  408. package/src/modules/sales/__integration__/TC-SALES-005.spec.ts +0 -21
  409. package/src/modules/sales/__integration__/TC-SALES-006.spec.ts +0 -26
  410. package/src/modules/sales/__integration__/TC-SALES-007.spec.ts +0 -23
  411. package/src/modules/sales/__integration__/TC-SALES-008.spec.ts +0 -11
  412. package/src/modules/sales/__integration__/TC-SALES-009.spec.ts +0 -12
  413. package/src/modules/sales/__integration__/TC-SALES-010.spec.ts +0 -20
  414. package/src/modules/sales/__integration__/TC-SALES-011.spec.ts +0 -26
  415. package/src/modules/sales/__integration__/TC-SALES-012.spec.ts +0 -12
  416. package/src/modules/sales/__integration__/TC-SALES-013.spec.ts +0 -73
  417. package/src/modules/sales/__integration__/TC-SALES-014.spec.ts +0 -17
  418. package/src/modules/sales/__integration__/TC-SALES-015.spec.ts +0 -17
  419. package/src/modules/sales/__integration__/TC-SALES-016.spec.ts +0 -17
  420. package/src/modules/sales/__integration__/TC-SALES-017.spec.ts +0 -60
  421. package/src/modules/sales/__integration__/TC-SALES-018.spec.ts +0 -25
  422. package/src/modules/sales/__integration__/TC-SALES-019.spec.ts +0 -22
  423. package/src/modules/sales/__integration__/TC-SALES-020.spec.ts +0 -107
  424. package/src/modules/sales/api/__tests__/channels.route.test.ts +0 -50
  425. package/src/modules/sales/api/__tests__/document-history.test.ts +0 -146
  426. package/src/modules/sales/api/__tests__/documents.factory.test.ts +0 -98
  427. package/src/modules/sales/api/__tests__/documents.routes.test.ts +0 -149
  428. package/src/modules/sales/api/__tests__/quotes.acceptance.test.ts +0 -209
  429. package/src/modules/sales/api/__tests__/timeline.test.tsx +0 -165
  430. package/src/modules/sales/api/dashboard/widgets/new-orders/__tests__/route.test.ts +0 -112
  431. package/src/modules/sales/api/dashboard/widgets/new-quotes/__tests__/route.test.ts +0 -116
  432. package/src/modules/sales/commands/__tests__/documents.cache.test.ts +0 -126
  433. package/src/modules/sales/commands/__tests__/documents.undo.test.ts +0 -170
  434. package/src/modules/sales/commands/__tests__/registration.test.ts +0 -141
  435. package/src/modules/sales/components/__tests__/salesComponentsRender.test.tsx +0 -456
  436. package/src/modules/sales/lib/__tests__/calculations.test.ts +0 -210
  437. package/src/modules/sales/services/__tests__/salesCalculationService.test.ts +0 -181
  438. package/src/modules/sales/services/__tests__/taxCalculationService.test.ts +0 -79
  439. package/src/modules/sales/widgets/dashboard/new-orders/__tests__/config.test.ts +0 -47
  440. package/src/modules/sales/widgets/dashboard/new-quotes/__tests__/config.test.ts +0 -47
  441. package/src/modules/staff/__integration__/TC-INT-006.spec.ts +0 -71
  442. package/src/modules/staff/data/__tests__/validators.test.ts +0 -60
  443. package/src/modules/translations/__integration__/TC-TRANS-001.spec.ts +0 -57
  444. package/src/modules/translations/__integration__/TC-TRANS-002.spec.ts +0 -114
  445. package/src/modules/translations/__integration__/TC-TRANS-003.spec.ts +0 -71
  446. package/src/modules/translations/__integration__/TC-TRANS-004.spec.ts +0 -66
  447. package/src/modules/translations/__integration__/TC-TRANS-005.spec.ts +0 -135
  448. package/src/modules/translations/__integration__/TC-TRANS-006.spec.ts +0 -113
  449. package/src/modules/translations/__integration__/TC-TRANS-007.spec.ts +0 -80
  450. package/src/modules/translations/__integration__/TC-TRANS-008.spec.ts +0 -209
  451. package/src/modules/translations/__integration__/helpers/translationFixtures.ts +0 -95
  452. package/src/modules/translations/api/__tests__/locales.test.ts +0 -67
  453. package/src/modules/translations/data/__tests__/validators.test.ts +0 -143
  454. package/src/modules/translations/lib/__tests__/extract-record-id.test.ts +0 -75
  455. package/src/modules/translations/lib/__tests__/helpers.test.ts +0 -215
  456. package/src/modules/translations/lib/__tests__/locale.test.ts +0 -115
  457. package/src/modules/translations/lib/__tests__/resolve-field-list.test.ts +0 -176
  458. package/src/modules/translations/lib/__tests__/translatable-fields.test.ts +0 -79
  459. package/src/modules/translations/widgets/__tests__/injection-table.test.ts +0 -83
  460. package/src/modules/workflows/__integration__/TC-WF-001.spec.ts +0 -114
  461. package/src/modules/workflows/api/__tests__/definitions.route.test.ts +0 -762
  462. package/src/modules/workflows/api/__tests__/instances.route.test.ts +0 -869
  463. package/src/modules/workflows/data/__tests__/validators.test.ts +0 -707
  464. package/src/modules/workflows/lib/__tests__/activity-executor.test.ts +0 -1230
  465. package/src/modules/workflows/lib/__tests__/call-api.test.ts +0 -421
  466. package/src/modules/workflows/lib/__tests__/compensation.test.ts +0 -713
  467. package/src/modules/workflows/lib/__tests__/event-logger.test.ts +0 -615
  468. package/src/modules/workflows/lib/__tests__/integration.test.ts +0 -693
  469. package/src/modules/workflows/lib/__tests__/signals.test.ts +0 -566
  470. package/src/modules/workflows/lib/__tests__/step-handler.test.ts +0 -670
  471. package/src/modules/workflows/lib/__tests__/sub-workflow.test.ts +0 -934
  472. package/src/modules/workflows/lib/__tests__/transition-handler.test.ts +0 -925
  473. package/src/modules/workflows/lib/__tests__/workflow-executor.test.ts +0 -684
@@ -1,456 +0,0 @@
1
- /**
2
- * @jest-environment jsdom
3
- */
4
- import * as React from 'react'
5
- import { render, screen, fireEvent, waitFor } from '@testing-library/react'
6
- import { PriceWithCurrency, formatPriceWithCurrency } from '../PriceWithCurrency'
7
- import { DocumentCustomerCard } from '../DocumentCustomerCard'
8
- import { DocumentTotals } from '../documents/DocumentTotals'
9
- import { DocumentNumberSettings } from '../DocumentNumberSettings'
10
- import { OrderEditingSettings } from '../OrderEditingSettings'
11
- import { AdjustmentKindSettings } from '../AdjustmentKindSettings'
12
- import { PaymentMethodsSettings } from '../PaymentMethodsSettings'
13
- import { ShippingMethodsSettings } from '../ShippingMethodsSettings'
14
- import { StatusSettings } from '../StatusSettings'
15
- import { TaxRatesSettings } from '../TaxRatesSettings'
16
- import { SalesChannelOffersPanel } from '../channels/SalesChannelOffersPanel'
17
- import { ChannelOfferForm } from '../channels/ChannelOfferForm'
18
-
19
- const mockApiCall = jest.fn()
20
- const mockReadApiResultOrThrow = jest.fn()
21
- const mockCreateCrud = jest.fn()
22
- const mockUpdateCrud = jest.fn()
23
- const mockDeleteCrud = jest.fn()
24
- const mockFlash = jest.fn()
25
- const mockCollectCustomFieldValues = jest.fn().mockReturnValue({})
26
-
27
- jest.mock('@open-mercato/ui/backend/utils/apiCall', () => ({
28
- apiCall: (...args: any[]) => mockApiCall(...args),
29
- apiCallOrThrow: (...args: any[]) => mockReadApiResultOrThrow(...args),
30
- readApiResultOrThrow: (...args: any[]) => mockReadApiResultOrThrow(...args),
31
- }))
32
-
33
- jest.mock('@open-mercato/ui/backend/utils/crud', () => ({
34
- createCrud: (...args: any[]) => mockCreateCrud(...args),
35
- updateCrud: (...args: any[]) => mockUpdateCrud(...args),
36
- deleteCrud: (...args: any[]) => mockDeleteCrud(...args),
37
- buildCrudExportUrl: () => '/export.csv',
38
- }))
39
-
40
- jest.mock('@open-mercato/ui/backend/FlashMessages', () => ({
41
- flash: (...args: any[]) => mockFlash(...args),
42
- }))
43
-
44
- jest.mock('@open-mercato/ui/backend/CrudForm', () => ({
45
- CrudForm: ({
46
- children,
47
- fields = [],
48
- onSubmit,
49
- submitLabel = 'Submit',
50
- renderGroups,
51
- groups = [],
52
- }: any) => {
53
- const renderedFields = renderGroups
54
- ? renderGroups({
55
- groups,
56
- fields,
57
- renderField: (field: any) => (
58
- <div key={field.id ?? field.name} data-testid={`crud-field-${field.name ?? field.id}`}>
59
- {field.label ?? field.name}
60
- </div>
61
- ),
62
- })
63
- : fields.map((field: any) => (
64
- <div key={field.id ?? field.name} data-testid={`crud-field-${field.name ?? field.id}`}>
65
- {field.label ?? field.name}
66
- </div>
67
- ))
68
- return (
69
- <form
70
- onSubmit={(event) => {
71
- event.preventDefault()
72
- onSubmit?.({})
73
- }}
74
- >
75
- {renderedFields}
76
- {children}
77
- <button type="submit">{submitLabel}</button>
78
- </form>
79
- )
80
- },
81
- }))
82
-
83
- jest.mock('@open-mercato/ui/backend/DataTable', () => ({
84
- DataTable: ({ title, data = [], children }: any) => {
85
- const key = typeof title === 'string' ? title.replace(/\\s+/g, '-').toLowerCase() : 'table'
86
- return (
87
- <div>
88
- {title ? <h2>{title}</h2> : null}
89
- <div data-testid={`data-table-count-${key}`}>{Array.isArray(data) ? data.length : 0}</div>
90
- <div>{children}</div>
91
- {Array.isArray(data)
92
- ? data.map((row, idx) => (
93
- <div key={idx} data-testid="data-row">
94
- {row.title ?? row.label ?? row.name ?? row.code ?? row.value ?? row.id}
95
- </div>
96
- ))
97
- : null}
98
- </div>
99
- )
100
- },
101
- }))
102
-
103
- jest.mock('@open-mercato/ui/backend/RowActions', () => ({
104
- RowActions: ({ children }: { children?: React.ReactNode }) => <div>{children}</div>,
105
- }))
106
-
107
- jest.mock('@open-mercato/ui/backend/ValueIcons', () => ({
108
- BooleanIcon: ({ value }: { value?: boolean }) => <span>{value ? 'Yes' : 'No'}</span>,
109
- }))
110
-
111
- jest.mock('@open-mercato/ui/backend/detail', () => ({
112
- LoadingMessage: ({ label }: { label: string }) => <div>{label}</div>,
113
- ErrorMessage: ({ label }: { label: string }) => <div>{label}</div>,
114
- TabEmptyState: ({ title, action }: any) => (
115
- <div>
116
- <div>{title}</div>
117
- {action ? <button onClick={action.onClick}>{action.label}</button> : null}
118
- </div>
119
- ),
120
- }))
121
-
122
- jest.mock('@open-mercato/ui/backend/inputs', () => ({
123
- LookupSelect: ({ value, onChange, options = [] }: any) => (
124
- <select value={value ?? ''} onChange={(event) => onChange?.(event.target.value || null)}>
125
- <option value="">Select</option>
126
- {options.map((opt: any) => (
127
- <option key={opt.value} value={opt.value}>
128
- {opt.label}
129
- </option>
130
- ))}
131
- </select>
132
- ),
133
- }))
134
-
135
- jest.mock('@open-mercato/ui/backend/utils/customFieldValues', () => ({
136
- collectCustomFieldValues: (...args: any[]) => mockCollectCustomFieldValues(...args),
137
- }))
138
-
139
- jest.mock('@open-mercato/ui/backend/utils/serverErrors', () => ({
140
- raiseCrudError: jest.fn(),
141
- createCrudFormError: (message: string) => new Error(message),
142
- normalizeCrudServerError: (err: any) => ({ message: err?.message ?? 'error' }),
143
- }))
144
-
145
- jest.mock('@open-mercato/ui/primitives/button', () => ({
146
- Button: ({ children, ...props }: any) => (
147
- <button {...props} type={props.type || 'button'}>
148
- {children}
149
- </button>
150
- ),
151
- }))
152
-
153
- jest.mock('@open-mercato/ui/primitives/input', () => ({
154
- Input: ({ children, ...props }: any) => <input {...props}>{children}</input>,
155
- }))
156
-
157
- jest.mock('@open-mercato/ui/primitives/label', () => ({
158
- Label: ({ children, ...props }: any) => <label {...props}>{children}</label>,
159
- }))
160
-
161
- jest.mock('@open-mercato/ui/primitives/switch', () => ({
162
- Switch: ({ checked, onCheckedChange, ...props }: any) => (
163
- <input
164
- type="checkbox"
165
- role="switch"
166
- checked={!!checked}
167
- onChange={(event) => onCheckedChange?.(event.target.checked)}
168
- {...props}
169
- />
170
- ),
171
- }))
172
-
173
- jest.mock('@open-mercato/ui/primitives/textarea', () => ({
174
- Textarea: ({ children, ...props }: any) => <textarea {...props}>{children}</textarea>,
175
- }))
176
-
177
- jest.mock('@open-mercato/ui/primitives/dialog', () => ({
178
- Dialog: ({ children }: any) => <div>{children}</div>,
179
- DialogContent: ({ children }: any) => <div>{children}</div>,
180
- DialogDescription: ({ children }: any) => <p>{children}</p>,
181
- DialogFooter: ({ children }: any) => <div>{children}</div>,
182
- DialogHeader: ({ children }: any) => <div>{children}</div>,
183
- DialogTitle: ({ children }: any) => <h3>{children}</h3>,
184
- DialogTrigger: ({ children }: any) => <div>{children}</div>,
185
- }))
186
-
187
- jest.mock('@open-mercato/ui/primitives/badge', () => ({
188
- Badge: ({ children }: any) => <span>{children}</span>,
189
- }))
190
-
191
- jest.mock('@open-mercato/core/modules/dictionaries/components/AppearanceSelector', () => ({
192
- AppearanceSelector: () => <div>appearance</div>,
193
- }))
194
-
195
- jest.mock('@open-mercato/core/modules/dictionaries/components/dictionaryAppearance', () => ({
196
- renderDictionaryColor: () => <span>color</span>,
197
- renderDictionaryIcon: () => <span>icon</span>,
198
- ICON_SUGGESTIONS: [],
199
- }))
200
-
201
- jest.mock('@open-mercato/core/modules/dictionaries/components/DictionaryForm', () => ({
202
- DictionaryForm: ({ onSubmit, initialValues }: any) => (
203
- <form
204
- onSubmit={(event) => {
205
- event.preventDefault()
206
- onSubmit?.(initialValues ?? {})
207
- }}
208
- >
209
- <button type="submit">save</button>
210
- </form>
211
- ),
212
- }))
213
-
214
- jest.mock('@open-mercato/core/modules/dictionaries/components/DictionaryTable', () => ({
215
- DictionaryTable: ({ entries = [] }: any) => (
216
- <div data-testid="dictionary-table-count">{entries.length}</div>
217
- ),
218
- }))
219
-
220
- jest.mock('@open-mercato/core/modules/dictionaries/components/DictionaryEntrySelect', () => ({
221
- DictionaryEntrySelect: ({ value, onChange }: any) => (
222
- <select value={value ?? ''} onChange={(event) => onChange?.(event.target.value || null)}>
223
- <option value="">Select</option>
224
- </select>
225
- ),
226
- }))
227
-
228
- jest.mock('../../lib/providers', () => ({
229
- listPaymentProviders: () => [
230
- {
231
- key: 'stripe',
232
- label: 'Stripe',
233
- settings: { fields: [{ key: 'secret', label: 'Secret', type: 'secret' }], defaults: { secret: 'demo' } },
234
- },
235
- ],
236
- listShippingProviders: () => [
237
- { key: 'flat', label: 'Flat rate', settings: { fields: [], defaults: {} } },
238
- ],
239
- }))
240
-
241
- jest.mock('@open-mercato/shared/lib/custom-fields/normalize', () => ({
242
- normalizeCustomFieldResponse: (input: any) => input,
243
- }))
244
-
245
- jest.mock('@open-mercato/core/modules/sales/lib/frontend/documentTotalsEvents', () => ({
246
- emitSalesDocumentTotalsRefresh: jest.fn(),
247
- }))
248
-
249
- jest.mock('@open-mercato/core/modules/customers/components/detail/hooks/useCurrencyDictionary', () => ({
250
- useCurrencyDictionary: () => ({ data: { entries: [] }, refetch: jest.fn() }),
251
- }))
252
-
253
- jest.mock('@open-mercato/shared/lib/frontend/useOrganizationScope', () => ({
254
- useOrganizationScopeDetail: () => ({ organizationId: 'org', tenantId: 'tenant' }),
255
- }))
256
-
257
- jest.mock('@open-mercato/shared/lib/frontend/useOrganizationScope', () => ({
258
- useOrganizationScopeVersion: () => 1,
259
- useOrganizationScopeDetail: () => ({ organizationId: 'org', tenantId: 'tenant' }),
260
- }))
261
-
262
- jest.mock('@open-mercato/shared/lib/i18n/context', () => {
263
- // Provide actual translations so tests verify user-visible text
264
- const dict: Record<string, string> = {
265
- 'sales.documents.detail.totals.title': 'Totals',
266
- 'sales.documents.detail.totals.showDetails': 'Show details',
267
- 'sales.documents.detail.totals.hideDetails': 'Hide details',
268
- 'sales.documents.detail.totals.showingAll': 'Showing all totals',
269
- 'sales.documents.detail.totals.showingKey': 'Showing key totals · {{count}} more',
270
- }
271
- const translate = (
272
- key: string,
273
- fallbackOrParams?: string | Record<string, unknown>,
274
- params?: Record<string, unknown>
275
- ) => {
276
- let fallback: string | undefined
277
- let resolvedParams: Record<string, unknown> | undefined
278
-
279
- if (typeof fallbackOrParams === 'string') {
280
- fallback = fallbackOrParams
281
- resolvedParams = params
282
- } else {
283
- resolvedParams = fallbackOrParams ?? params
284
- }
285
-
286
- const template = dict[key] ?? fallback ?? key
287
- if (resolvedParams) {
288
- return template.replace(/\{\{(\w+)\}\}|\{(\w+)\}/g, (match, doubleKey, singleKey) => {
289
- const token = doubleKey ?? singleKey
290
- if (!token) return match
291
- const value = resolvedParams![token]
292
- return value !== undefined ? String(value) : match
293
- })
294
- }
295
- return template
296
- }
297
- return {
298
- useT: () => translate,
299
- }
300
- })
301
-
302
- jest.mock('next/navigation', () => ({
303
- useRouter: () => ({ push: jest.fn(), refresh: jest.fn(), replace: jest.fn() }),
304
- }))
305
-
306
- jest.mock('next/link', () => ({
307
- __esModule: true,
308
- default: ({ children, ...props }: any) => <a {...props}>{children}</a>,
309
- }))
310
-
311
- describe('sales components', () => {
312
- beforeEach(() => {
313
- jest.clearAllMocks()
314
- mockApiCall.mockResolvedValue({ ok: true, result: {} })
315
- mockReadApiResultOrThrow.mockResolvedValue({ items: [] })
316
- mockCreateCrud.mockResolvedValue({ ok: true })
317
- mockUpdateCrud.mockResolvedValue({ ok: true })
318
- mockDeleteCrud.mockResolvedValue({ ok: true })
319
- })
320
-
321
- it('formats prices with currency helper and component', () => {
322
- // Intl.NumberFormat output is locale-dependent, accept either symbol or code
323
- expect(formatPriceWithCurrency(10, 'USD')).toMatch(/\$|USD/)
324
- expect(formatPriceWithCurrency(null, 'USD')).toBe('—')
325
- render(<PriceWithCurrency amount={15} currency="EUR" />)
326
- expect(screen.getByText(/€|EUR/)).toBeInTheDocument()
327
- })
328
-
329
- it('renders DocumentCustomerCard and triggers selection', () => {
330
- const onSelect = jest.fn()
331
- render(
332
- <DocumentCustomerCard
333
- label="Customer"
334
- name="ACME"
335
- email="test@example.com"
336
- kind="company"
337
- onSelectCustomer={onSelect}
338
- />,
339
- )
340
- expect(screen.getByText('Customer')).toBeInTheDocument()
341
- fireEvent.click(screen.getByText('ACME'))
342
- expect(onSelect).toHaveBeenCalled()
343
- })
344
-
345
- it('toggles DocumentTotals details', () => {
346
- const items = [
347
- { key: 'subtotal', label: 'Subtotal', amount: 100 },
348
- { key: 'tax', label: 'Tax', amount: 20 },
349
- { key: 'shipping', label: 'Shipping', amount: 5 },
350
- { key: 'total', label: 'Total', amount: 120, emphasize: true },
351
- ]
352
- render(<DocumentTotals currency="USD" items={items} title="Summary" />)
353
- const toggle = screen.getByRole('button', { name: /show details/i })
354
- fireEvent.click(toggle)
355
- expect(screen.getByText('Subtotal')).toBeInTheDocument()
356
- expect(screen.getByText('Total')).toBeInTheDocument()
357
- })
358
-
359
- it('loads adjustment kinds into table', async () => {
360
- mockReadApiResultOrThrow.mockResolvedValueOnce({
361
- items: [{ id: 'adj-1', value: 'discount', label: 'Discount', color: '#ff0000', icon: null }],
362
- })
363
- render(<AdjustmentKindSettings />)
364
- await waitFor(() => expect(screen.getByTestId('data-table-count-table')).toHaveTextContent('1'))
365
- })
366
-
367
- it('renders payment methods settings table', async () => {
368
- mockReadApiResultOrThrow.mockResolvedValueOnce({
369
- items: [{ id: 'pm-1', name: 'Credit card', code: 'card', provider_key: 'stripe', providerKey: 'stripe' }],
370
- })
371
- render(<PaymentMethodsSettings />)
372
- await waitFor(() => expect(screen.getByText(/Credit card/i)).toBeInTheDocument())
373
- })
374
-
375
- it('renders shipping methods settings table', async () => {
376
- mockReadApiResultOrThrow.mockResolvedValueOnce({
377
- items: [{ id: 'ship-1', name: 'Courier', code: 'courier', isActive: true }],
378
- })
379
- render(<ShippingMethodsSettings />)
380
- await waitFor(() => expect(screen.getByText(/Courier/i)).toBeInTheDocument())
381
- })
382
-
383
- it('renders status settings with entries', async () => {
384
- mockReadApiResultOrThrow
385
- .mockResolvedValueOnce({ items: [{ id: 'st-1', value: 'new', label: 'New' }] })
386
- .mockResolvedValueOnce({ items: [{ id: 'ln-1', value: 'processing', label: 'Processing' }] })
387
- .mockResolvedValueOnce({ items: [{ id: 'sh-1', value: 'shipped', label: 'Shipped' }] })
388
- .mockResolvedValueOnce({ items: [{ id: 'pay-1', value: 'paid', label: 'Paid' }] })
389
- render(<StatusSettings />)
390
- await waitFor(() => {
391
- const tables = screen.getAllByTestId('dictionary-table-count')
392
- expect(tables).toHaveLength(4)
393
- tables.forEach((table) => expect(table).toHaveTextContent('1'))
394
- })
395
- })
396
-
397
- it('renders tax rates settings rows', async () => {
398
- mockReadApiResultOrThrow.mockResolvedValueOnce({
399
- items: [{ id: 'tax-1', code: 'vat', label: 'VAT', rate: 23 }],
400
- })
401
- render(<TaxRatesSettings />)
402
- await waitFor(() => expect(screen.getByText(/VAT/)).toBeInTheDocument())
403
- })
404
-
405
- it('renders document number settings with server data', async () => {
406
- mockApiCall.mockResolvedValueOnce({
407
- ok: true,
408
- result: {
409
- orderNumberFormat: 'ORD-{seq}',
410
- quoteNumberFormat: 'QUO-{seq}',
411
- nextOrderNumber: 10,
412
- nextQuoteNumber: 5,
413
- tokens: [],
414
- },
415
- })
416
- render(<DocumentNumberSettings />)
417
- await waitFor(() => expect(screen.getByDisplayValue('ORD-{seq}')).toBeInTheDocument())
418
- expect(screen.getByDisplayValue('QUO-{seq}')).toBeInTheDocument()
419
- })
420
-
421
- it('renders order editing settings', async () => {
422
- mockApiCall.mockResolvedValueOnce({
423
- ok: true,
424
- result: {
425
- enabledStatuses: ['draft'],
426
- enabledLineStatuses: ['open'],
427
- allowPriceChanges: true,
428
- allowQuantityChanges: true,
429
- },
430
- })
431
- render(<OrderEditingSettings />)
432
- await waitFor(() => expect(mockApiCall).toHaveBeenCalled())
433
- expect(screen.getAllByRole('switch').length).toBeGreaterThan(0)
434
- })
435
-
436
- it('renders sales channel offers panel', async () => {
437
- mockReadApiResultOrThrow.mockResolvedValueOnce({
438
- items: [
439
- { id: 'offer-1', title: 'Offer A', isActive: true, productTitle: 'Product A', pricing: null, updatedAt: null },
440
- ],
441
- total: 1,
442
- totalPages: 1,
443
- })
444
- render(<SalesChannelOffersPanel channelId="channel-1" channelName="Online" />)
445
- await waitFor(() => expect(screen.getAllByTestId('data-row').length).toBeGreaterThan(0))
446
- })
447
-
448
- it('renders channel offer form in create mode', async () => {
449
- mockReadApiResultOrThrow.mockResolvedValue({
450
- items: [],
451
- })
452
- render(<ChannelOfferForm channelId="channel-1" mode="create" />)
453
- await waitFor(() => expect(mockReadApiResultOrThrow).toHaveBeenCalled())
454
- expect(screen.getByRole('button', { name: /create|save|submit/i })).toBeInTheDocument()
455
- })
456
- })
@@ -1,210 +0,0 @@
1
- import {
2
- calculateDocumentTotals,
3
- registerSalesTotalsCalculator,
4
- } from '../calculations'
5
- import type { SalesAdjustmentDraft, SalesLineSnapshot } from '../types'
6
-
7
- const baseContext = {
8
- tenantId: 'tenant-1',
9
- organizationId: 'org-1',
10
- currencyCode: 'USD',
11
- }
12
-
13
- describe('calculateDocumentTotals', () => {
14
- it('calculates order line totals and aggregates adjustments', async () => {
15
- const lines: SalesLineSnapshot[] = [
16
- {
17
- kind: 'product',
18
- quantity: 2,
19
- currencyCode: 'USD',
20
- unitPriceNet: 10,
21
- taxRate: 20,
22
- },
23
- {
24
- kind: 'product',
25
- quantity: 1,
26
- currencyCode: 'USD',
27
- unitPriceGross: 12,
28
- discountPercent: 10,
29
- taxRate: 20,
30
- },
31
- ]
32
- const adjustments: SalesAdjustmentDraft[] = [
33
- {
34
- scope: 'order',
35
- kind: 'discount',
36
- amountNet: 5,
37
- amountGross: 5,
38
- currencyCode: 'USD',
39
- },
40
- {
41
- scope: 'order',
42
- kind: 'shipping',
43
- rate: 10,
44
- currencyCode: 'USD',
45
- metadata: { taxRateValue: 20 },
46
- },
47
- ]
48
-
49
- const result = await calculateDocumentTotals({
50
- documentKind: 'order',
51
- lines,
52
- adjustments,
53
- context: { ...baseContext, metadata: {} },
54
- })
55
-
56
- expect(result.lines).toHaveLength(2)
57
- expect(result.lines[0]).toMatchObject({
58
- netAmount: 20,
59
- grossAmount: 24,
60
- taxAmount: 4,
61
- discountAmount: 0,
62
- })
63
- expect(result.lines[1].netAmount).toBeCloseTo(9, 4)
64
- expect(result.lines[1].grossAmount).toBeCloseTo(10.8, 4)
65
- expect(result.lines[1].discountAmount).toBeCloseTo(1, 4)
66
-
67
- const shippingAdj = result.adjustments.find((adj) => adj.kind === 'shipping')
68
- expect(shippingAdj?.amountNet).toBeCloseTo(2.9, 4)
69
- expect(shippingAdj?.amountGross).toBeCloseTo(3.48, 4)
70
-
71
- expect(result.totals.subtotalNetAmount).toBeCloseTo(26.9, 4)
72
- expect(result.totals.subtotalGrossAmount).toBeCloseTo(33.28, 4)
73
- expect(result.totals.discountTotalAmount).toBeCloseTo(6, 4)
74
- expect(result.totals.taxTotalAmount).toBeCloseTo(6.38, 4)
75
- expect(result.totals.shippingNetAmount).toBeCloseTo(2.9, 4)
76
- expect(result.totals.shippingGrossAmount).toBeCloseTo(3.48, 4)
77
- expect(result.totals.grandTotalGrossAmount).toBeCloseTo(33.28, 4)
78
- expect(result.totals.outstandingAmount).toBeCloseTo(33.28, 4)
79
- })
80
-
81
- it('calculates quote totals per line with discounts', async () => {
82
- const lines: SalesLineSnapshot[] = [
83
- {
84
- kind: 'product',
85
- quantity: 3,
86
- currencyCode: 'USD',
87
- unitPriceNet: 15,
88
- discountPercent: 10,
89
- taxRate: 0,
90
- },
91
- ]
92
-
93
- const result = await calculateDocumentTotals({
94
- documentKind: 'quote',
95
- lines,
96
- adjustments: [],
97
- context: { ...baseContext, metadata: {} },
98
- })
99
-
100
- expect(result.lines[0].netAmount).toBeCloseTo(40.5, 4)
101
- expect(result.lines[0].discountAmount).toBeCloseTo(4.5, 4)
102
- expect(result.totals.subtotalNetAmount).toBeCloseTo(40.5, 4)
103
- expect(result.totals.subtotalGrossAmount).toBeCloseTo(40.5, 4)
104
- expect(result.totals.discountTotalAmount).toBeCloseTo(4.5, 4)
105
- expect(result.totals.grandTotalGrossAmount).toBeCloseTo(40.5, 4)
106
- })
107
-
108
- it('keeps manual adjustment amounts when rate defaults to zero', async () => {
109
- const lines: SalesLineSnapshot[] = [
110
- {
111
- kind: 'product',
112
- quantity: 1,
113
- currencyCode: 'USD',
114
- unitPriceNet: 10,
115
- taxRate: 0,
116
- },
117
- ]
118
-
119
- const adjustments: SalesAdjustmentDraft[] = [
120
- {
121
- scope: 'order',
122
- kind: 'shipping',
123
- rate: 0,
124
- amountNet: 9.9,
125
- amountGross: 9.9,
126
- currencyCode: 'USD',
127
- metadata: { manualOverride: true },
128
- },
129
- ]
130
-
131
- const result = await calculateDocumentTotals({
132
- documentKind: 'order',
133
- lines,
134
- adjustments,
135
- context: { ...baseContext, metadata: {} },
136
- })
137
-
138
- const shipping = result.adjustments.find((entry) => entry.kind === 'shipping')
139
- expect(shipping?.amountNet).toBeCloseTo(9.9, 4)
140
- expect(shipping?.amountGross).toBeCloseTo(9.9, 4)
141
- expect(result.totals.shippingNetAmount).toBeCloseTo(9.9, 4)
142
- expect(result.totals.shippingGrossAmount).toBeCloseTo(9.9, 4)
143
- })
144
-
145
- it('preserves existing payment totals when recalculating order amounts', async () => {
146
- const lines: SalesLineSnapshot[] = [
147
- {
148
- kind: 'product',
149
- quantity: 2,
150
- currencyCode: 'USD',
151
- unitPriceGross: 50,
152
- taxRate: 0,
153
- },
154
- ]
155
-
156
- const result = await calculateDocumentTotals({
157
- documentKind: 'order',
158
- lines,
159
- adjustments: [],
160
- context: { ...baseContext, metadata: {} },
161
- existingTotals: { paidTotalAmount: 25, refundedTotalAmount: 5 },
162
- })
163
-
164
- expect(result.totals.grandTotalGrossAmount).toBeCloseTo(100, 4)
165
- expect(result.totals.paidTotalAmount).toBe(25)
166
- expect(result.totals.refundedTotalAmount).toBe(5)
167
- expect(result.totals.outstandingAmount).toBeCloseTo(80, 4)
168
- })
169
-
170
- it('supports overriding payment-aware totals via calculators', async () => {
171
- const unregister = registerSalesTotalsCalculator(({ current, context }) => {
172
- const payments = (context.metadata as any)?.payments ?? {}
173
- const paid = Number(payments.paid ?? 0)
174
- const refunded = Number(payments.refunded ?? 0)
175
- const outstanding = Math.max(current.totals.grandTotalGrossAmount - paid + refunded, 0)
176
- return {
177
- ...current,
178
- totals: {
179
- ...current.totals,
180
- paidTotalAmount: paid,
181
- refundedTotalAmount: refunded,
182
- outstandingAmount: outstanding,
183
- },
184
- }
185
- })
186
-
187
- try {
188
- const result = await calculateDocumentTotals({
189
- documentKind: 'order',
190
- lines: [
191
- {
192
- kind: 'product',
193
- quantity: 1,
194
- currencyCode: 'USD',
195
- unitPriceNet: 100,
196
- taxRate: 0,
197
- },
198
- ],
199
- context: { ...baseContext, metadata: { payments: { paid: 40, refunded: 5 } } },
200
- })
201
-
202
- expect(result.totals.grandTotalGrossAmount).toBeCloseTo(100, 4)
203
- expect(result.totals.paidTotalAmount).toBe(40)
204
- expect(result.totals.refundedTotalAmount).toBe(5)
205
- expect(result.totals.outstandingAmount).toBeCloseTo(65, 4)
206
- } finally {
207
- unregister()
208
- }
209
- })
210
- })