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