@reventlessdev/online-shop-aggregates-ordering 3.0.0-alpha.248 → 3.0.0-alpha.250

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 (207) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/lib/bs/.compiler.log +2 -2
  3. package/lib/bs/OrderingPlugin.cmi +0 -0
  4. package/lib/bs/OrderingPlugin.cmt +0 -0
  5. package/lib/bs/OrderingPlugin.mlmap +1 -0
  6. package/lib/bs/compiler-info.json +1 -1
  7. package/lib/bs/src/CatalogProduct/Aggregate/CatalogProduct-OrderingPlugin.cmi +0 -0
  8. package/lib/bs/src/CatalogProduct/Aggregate/CatalogProduct-OrderingPlugin.cmt +0 -0
  9. package/lib/bs/src/CatalogProduct/Aggregate/CatalogProduct_Behavior-OrderingPlugin.cmi +0 -0
  10. package/lib/bs/src/CatalogProduct/Aggregate/CatalogProduct_Behavior-OrderingPlugin.cmt +0 -0
  11. package/lib/bs/src/CatalogProduct/ReadModel/AvailableProducts-OrderingPlugin.cmi +0 -0
  12. package/lib/bs/src/CatalogProduct/ReadModel/AvailableProducts-OrderingPlugin.cmt +0 -0
  13. package/lib/bs/src/CatalogProduct/ReadModel/AvailableProducts_Projections-OrderingPlugin.cmi +0 -0
  14. package/lib/bs/src/CatalogProduct/ReadModel/AvailableProducts_Projections-OrderingPlugin.cmt +0 -0
  15. package/lib/bs/src/Customer/Aggregate/Customer-OrderingPlugin.cmi +0 -0
  16. package/lib/bs/src/Customer/Aggregate/Customer-OrderingPlugin.cmt +0 -0
  17. package/lib/bs/src/Customer/Aggregate/Customer_Behavior-OrderingPlugin.cmi +0 -0
  18. package/lib/bs/src/Customer/Aggregate/Customer_Behavior-OrderingPlugin.cmt +0 -0
  19. package/lib/bs/src/Customer/CustomerId-OrderingPlugin.cmi +0 -0
  20. package/lib/bs/src/Customer/CustomerId-OrderingPlugin.cmt +0 -0
  21. package/lib/bs/src/Customer/ReadModel/Customers-OrderingPlugin.cmi +0 -0
  22. package/lib/bs/src/Customer/ReadModel/Customers-OrderingPlugin.cmt +0 -0
  23. package/lib/bs/src/Customer/ReadModel/Customers_Projections-OrderingPlugin.cmi +0 -0
  24. package/lib/bs/src/Customer/ReadModel/Customers_Projections-OrderingPlugin.cmt +0 -0
  25. package/lib/bs/src/Extension/Products_Extension-OrderingPlugin.cmi +0 -0
  26. package/lib/bs/src/Extension/Products_Extension-OrderingPlugin.cmt +0 -0
  27. package/lib/bs/src/ExtensionPoint/Orders_ExtensionPointMapping-OrderingPlugin.cmi +0 -0
  28. package/lib/bs/src/ExtensionPoint/Orders_ExtensionPointMapping-OrderingPlugin.cmt +0 -0
  29. package/lib/bs/src/LifecycleModel-OrderingPlugin.cmi +0 -0
  30. package/lib/bs/src/LifecycleModel-OrderingPlugin.cmt +0 -0
  31. package/lib/bs/src/Order/Aggregate/Order-OrderingPlugin.cmi +0 -0
  32. package/lib/bs/src/Order/Aggregate/Order-OrderingPlugin.cmt +0 -0
  33. package/lib/bs/src/Order/Aggregate/Order_Behavior-OrderingPlugin.cmi +0 -0
  34. package/lib/bs/src/Order/Aggregate/Order_Behavior-OrderingPlugin.cmt +0 -0
  35. package/lib/bs/src/Order/Aggregate/Order_Mappings-OrderingPlugin.cmi +0 -0
  36. package/lib/bs/src/Order/Aggregate/Order_Mappings-OrderingPlugin.cmt +0 -0
  37. package/lib/bs/src/Order/OrderId-OrderingPlugin.cmi +0 -0
  38. package/lib/bs/src/Order/OrderId-OrderingPlugin.cmt +0 -0
  39. package/lib/bs/src/Order/ReadModel/Orders-OrderingPlugin.cmi +0 -0
  40. package/lib/bs/src/Order/ReadModel/Orders-OrderingPlugin.cmt +0 -0
  41. package/lib/bs/src/Order/ReadModel/Orders_Projections-OrderingPlugin.cmi +0 -0
  42. package/lib/bs/src/Order/ReadModel/Orders_Projections-OrderingPlugin.cmt +0 -0
  43. package/lib/bs/src/Order/SideEffect/Order_EmailNotification-OrderingPlugin.cmi +0 -0
  44. package/lib/bs/src/Order/SideEffect/Order_EmailNotification-OrderingPlugin.cmt +0 -0
  45. package/lib/bs/src/Plugin-OrderingPlugin.cmi +0 -0
  46. package/lib/bs/src/Plugin-OrderingPlugin.cmt +0 -0
  47. package/lib/bs/src/Task/OrderNotifications-OrderingPlugin.cmi +0 -0
  48. package/lib/bs/src/Task/OrderNotifications-OrderingPlugin.cmt +0 -0
  49. package/lib/bs/tests/CatalogProduct/Aggregate/CatalogProduct_GWT-OrderingPlugin.cmi +0 -0
  50. package/lib/bs/tests/CatalogProduct/Aggregate/CatalogProduct_GWT-OrderingPlugin.cmt +0 -0
  51. package/lib/bs/tests/CatalogProduct/Aggregate/CatalogProduct_GWT.ast +0 -0
  52. package/lib/bs/tests/CatalogProduct/Aggregate/CatalogProduct_GWT.res +11 -5
  53. package/lib/bs/tests/CatalogProduct/Aggregate/CatalogProduct_GWT.res.mjs +6 -5
  54. package/lib/bs/tests/CatalogProduct/ReadModel/AvailableProducts_GWT-OrderingPlugin.cmi +0 -0
  55. package/lib/bs/tests/CatalogProduct/ReadModel/AvailableProducts_GWT-OrderingPlugin.cmt +0 -0
  56. package/lib/bs/tests/CatalogProduct/ReadModel/AvailableProducts_GWT.ast +0 -0
  57. package/lib/bs/tests/CatalogProduct/ReadModel/AvailableProducts_GWT.res +2 -0
  58. package/lib/bs/tests/Customer/Aggregate/Customer_GWT-OrderingPlugin.cmi +0 -0
  59. package/lib/bs/tests/Customer/Aggregate/Customer_GWT-OrderingPlugin.cmt +0 -0
  60. package/lib/bs/tests/Customer/Aggregate/Customer_GWT.ast +0 -0
  61. package/lib/bs/tests/Customer/Aggregate/Customer_GWT.res +32 -17
  62. package/lib/bs/tests/Customer/Aggregate/Customer_GWT.res.mjs +31 -30
  63. package/lib/bs/tests/Customer/ReadModel/Customers_GWT-OrderingPlugin.cmi +0 -0
  64. package/lib/bs/tests/Customer/ReadModel/Customers_GWT-OrderingPlugin.cmt +0 -0
  65. package/lib/bs/tests/Customer/ReadModel/Customers_GWT.ast +0 -0
  66. package/lib/bs/tests/Customer/ReadModel/Customers_GWT.res +4 -0
  67. package/lib/bs/tests/Extension/Products_Extension_GWT-OrderingPlugin.cmi +0 -0
  68. package/lib/bs/tests/Extension/Products_Extension_GWT-OrderingPlugin.cmt +0 -0
  69. package/lib/bs/tests/Extension/Products_Extension_GWT.ast +0 -0
  70. package/lib/bs/tests/Extension/Products_Extension_GWT.res +3 -2
  71. package/lib/bs/tests/Extension/Products_Extension_GWT.res.mjs +3 -5
  72. package/lib/bs/tests/ExtensionPoint/Orders_ExtensionPointMapping_GWT-OrderingPlugin.cmi +0 -0
  73. package/lib/bs/tests/ExtensionPoint/Orders_ExtensionPointMapping_GWT-OrderingPlugin.cmt +0 -0
  74. package/lib/bs/tests/ExtensionPoint/Orders_ExtensionPointMapping_GWT.ast +0 -0
  75. package/lib/bs/tests/ExtensionPoint/Orders_ExtensionPointMapping_GWT.res +5 -3
  76. package/lib/bs/tests/ExtensionPoint/Orders_ExtensionPointMapping_GWT.res.mjs +6 -16
  77. package/lib/bs/tests/Order/Aggregate/OrderMappings_GWT-OrderingPlugin.cmi +0 -0
  78. package/lib/bs/tests/Order/Aggregate/OrderMappings_GWT-OrderingPlugin.cmt +0 -0
  79. package/lib/bs/tests/Order/Aggregate/OrderMappings_GWT.ast +0 -0
  80. package/lib/bs/tests/Order/Aggregate/OrderMappings_GWT.res +4 -0
  81. package/lib/bs/tests/Order/Aggregate/Order_GWT-OrderingPlugin.cmi +0 -0
  82. package/lib/bs/tests/Order/Aggregate/Order_GWT-OrderingPlugin.cmt +0 -0
  83. package/lib/bs/tests/Order/Aggregate/Order_GWT.ast +0 -0
  84. package/lib/bs/tests/Order/Aggregate/Order_GWT.res +24 -5
  85. package/lib/bs/tests/Order/Aggregate/Order_GWT.res.mjs +6 -5
  86. package/lib/bs/tests/Order/ReadModel/Orders_GWT-OrderingPlugin.cmi +0 -0
  87. package/lib/bs/tests/Order/ReadModel/Orders_GWT-OrderingPlugin.cmt +0 -0
  88. package/lib/bs/tests/Order/ReadModel/Orders_GWT.ast +0 -0
  89. package/lib/bs/tests/Order/ReadModel/Orders_GWT.res +4 -0
  90. package/lib/bs/tests/Order/SideEffect/EmailService_Mock-OrderingPlugin.cmi +0 -0
  91. package/lib/bs/tests/Order/SideEffect/EmailService_Mock-OrderingPlugin.cmt +0 -0
  92. package/lib/bs/tests/Order/SideEffect/Order_EmailNotification_GWT-OrderingPlugin.cmi +0 -0
  93. package/lib/bs/tests/Order/SideEffect/Order_EmailNotification_GWT-OrderingPlugin.cmt +0 -0
  94. package/lib/bs/tests/Ordering_Examples-OrderingPlugin.cmi +0 -0
  95. package/lib/bs/tests/Ordering_Examples-OrderingPlugin.cmj +0 -0
  96. package/lib/bs/tests/Ordering_Examples-OrderingPlugin.cmt +0 -0
  97. package/lib/bs/tests/Ordering_Examples.ast +0 -0
  98. package/lib/bs/tests/Ordering_Examples.res +13 -0
  99. package/lib/bs/tests/Ordering_Examples.res.mjs +35 -0
  100. package/lib/ocaml/.compiler.log +2 -2
  101. package/lib/ocaml/AvailableProducts-OrderingPlugin.cmi +0 -0
  102. package/lib/ocaml/AvailableProducts-OrderingPlugin.cmt +0 -0
  103. package/lib/ocaml/AvailableProducts_GWT-OrderingPlugin.cmi +0 -0
  104. package/lib/ocaml/AvailableProducts_GWT-OrderingPlugin.cmt +0 -0
  105. package/lib/ocaml/AvailableProducts_GWT.ast +0 -0
  106. package/lib/ocaml/AvailableProducts_GWT.res +2 -0
  107. package/lib/ocaml/AvailableProducts_Projections-OrderingPlugin.cmi +0 -0
  108. package/lib/ocaml/AvailableProducts_Projections-OrderingPlugin.cmt +0 -0
  109. package/lib/ocaml/CatalogProduct-OrderingPlugin.cmi +0 -0
  110. package/lib/ocaml/CatalogProduct-OrderingPlugin.cmt +0 -0
  111. package/lib/ocaml/CatalogProduct_Behavior-OrderingPlugin.cmi +0 -0
  112. package/lib/ocaml/CatalogProduct_Behavior-OrderingPlugin.cmt +0 -0
  113. package/lib/ocaml/CatalogProduct_GWT-OrderingPlugin.cmi +0 -0
  114. package/lib/ocaml/CatalogProduct_GWT-OrderingPlugin.cmt +0 -0
  115. package/lib/ocaml/CatalogProduct_GWT.ast +0 -0
  116. package/lib/ocaml/CatalogProduct_GWT.res +11 -5
  117. package/lib/ocaml/Customer-OrderingPlugin.cmi +0 -0
  118. package/lib/ocaml/Customer-OrderingPlugin.cmt +0 -0
  119. package/lib/ocaml/CustomerId-OrderingPlugin.cmi +0 -0
  120. package/lib/ocaml/CustomerId-OrderingPlugin.cmt +0 -0
  121. package/lib/ocaml/Customer_Behavior-OrderingPlugin.cmi +0 -0
  122. package/lib/ocaml/Customer_Behavior-OrderingPlugin.cmt +0 -0
  123. package/lib/ocaml/Customer_GWT-OrderingPlugin.cmi +0 -0
  124. package/lib/ocaml/Customer_GWT-OrderingPlugin.cmt +0 -0
  125. package/lib/ocaml/Customer_GWT.ast +0 -0
  126. package/lib/ocaml/Customer_GWT.res +32 -17
  127. package/lib/ocaml/Customers-OrderingPlugin.cmi +0 -0
  128. package/lib/ocaml/Customers-OrderingPlugin.cmt +0 -0
  129. package/lib/ocaml/Customers_GWT-OrderingPlugin.cmi +0 -0
  130. package/lib/ocaml/Customers_GWT-OrderingPlugin.cmt +0 -0
  131. package/lib/ocaml/Customers_GWT.ast +0 -0
  132. package/lib/ocaml/Customers_GWT.res +4 -0
  133. package/lib/ocaml/Customers_Projections-OrderingPlugin.cmi +0 -0
  134. package/lib/ocaml/Customers_Projections-OrderingPlugin.cmt +0 -0
  135. package/lib/ocaml/EmailService_Mock-OrderingPlugin.cmi +0 -0
  136. package/lib/ocaml/EmailService_Mock-OrderingPlugin.cmt +0 -0
  137. package/lib/ocaml/LifecycleModel-OrderingPlugin.cmi +0 -0
  138. package/lib/ocaml/LifecycleModel-OrderingPlugin.cmt +0 -0
  139. package/lib/ocaml/Order-OrderingPlugin.cmi +0 -0
  140. package/lib/ocaml/Order-OrderingPlugin.cmt +0 -0
  141. package/lib/ocaml/OrderId-OrderingPlugin.cmi +0 -0
  142. package/lib/ocaml/OrderId-OrderingPlugin.cmt +0 -0
  143. package/lib/ocaml/OrderMappings_GWT-OrderingPlugin.cmi +0 -0
  144. package/lib/ocaml/OrderMappings_GWT-OrderingPlugin.cmt +0 -0
  145. package/lib/ocaml/OrderMappings_GWT.ast +0 -0
  146. package/lib/ocaml/OrderMappings_GWT.res +4 -0
  147. package/lib/ocaml/OrderNotifications-OrderingPlugin.cmi +0 -0
  148. package/lib/ocaml/OrderNotifications-OrderingPlugin.cmt +0 -0
  149. package/lib/ocaml/Order_Behavior-OrderingPlugin.cmi +0 -0
  150. package/lib/ocaml/Order_Behavior-OrderingPlugin.cmt +0 -0
  151. package/lib/ocaml/Order_EmailNotification-OrderingPlugin.cmi +0 -0
  152. package/lib/ocaml/Order_EmailNotification-OrderingPlugin.cmt +0 -0
  153. package/lib/ocaml/Order_EmailNotification_GWT-OrderingPlugin.cmi +0 -0
  154. package/lib/ocaml/Order_EmailNotification_GWT-OrderingPlugin.cmt +0 -0
  155. package/lib/ocaml/Order_GWT-OrderingPlugin.cmi +0 -0
  156. package/lib/ocaml/Order_GWT-OrderingPlugin.cmt +0 -0
  157. package/lib/ocaml/Order_GWT.ast +0 -0
  158. package/lib/ocaml/Order_GWT.res +24 -5
  159. package/lib/ocaml/Order_Mappings-OrderingPlugin.cmi +0 -0
  160. package/lib/ocaml/Order_Mappings-OrderingPlugin.cmt +0 -0
  161. package/lib/ocaml/OrderingPlugin.cmi +0 -0
  162. package/lib/ocaml/OrderingPlugin.cmt +0 -0
  163. package/lib/ocaml/OrderingPlugin.mlmap +1 -0
  164. package/lib/ocaml/Ordering_Examples-OrderingPlugin.cmi +0 -0
  165. package/lib/ocaml/Ordering_Examples-OrderingPlugin.cmj +0 -0
  166. package/lib/ocaml/Ordering_Examples-OrderingPlugin.cmt +0 -0
  167. package/lib/ocaml/Ordering_Examples.ast +0 -0
  168. package/lib/ocaml/Ordering_Examples.res +13 -0
  169. package/lib/ocaml/Orders-OrderingPlugin.cmi +0 -0
  170. package/lib/ocaml/Orders-OrderingPlugin.cmt +0 -0
  171. package/lib/ocaml/Orders_ExtensionPointMapping-OrderingPlugin.cmi +0 -0
  172. package/lib/ocaml/Orders_ExtensionPointMapping-OrderingPlugin.cmt +0 -0
  173. package/lib/ocaml/Orders_ExtensionPointMapping_GWT-OrderingPlugin.cmi +0 -0
  174. package/lib/ocaml/Orders_ExtensionPointMapping_GWT-OrderingPlugin.cmt +0 -0
  175. package/lib/ocaml/Orders_ExtensionPointMapping_GWT.ast +0 -0
  176. package/lib/ocaml/Orders_ExtensionPointMapping_GWT.res +5 -3
  177. package/lib/ocaml/Orders_GWT-OrderingPlugin.cmi +0 -0
  178. package/lib/ocaml/Orders_GWT-OrderingPlugin.cmt +0 -0
  179. package/lib/ocaml/Orders_GWT.ast +0 -0
  180. package/lib/ocaml/Orders_GWT.res +4 -0
  181. package/lib/ocaml/Orders_Projections-OrderingPlugin.cmi +0 -0
  182. package/lib/ocaml/Orders_Projections-OrderingPlugin.cmt +0 -0
  183. package/lib/ocaml/Plugin-OrderingPlugin.cmi +0 -0
  184. package/lib/ocaml/Plugin-OrderingPlugin.cmt +0 -0
  185. package/lib/ocaml/Products_Extension-OrderingPlugin.cmi +0 -0
  186. package/lib/ocaml/Products_Extension-OrderingPlugin.cmt +0 -0
  187. package/lib/ocaml/Products_Extension_GWT-OrderingPlugin.cmi +0 -0
  188. package/lib/ocaml/Products_Extension_GWT-OrderingPlugin.cmt +0 -0
  189. package/lib/ocaml/Products_Extension_GWT.ast +0 -0
  190. package/lib/ocaml/Products_Extension_GWT.res +3 -2
  191. package/package.json +8 -8
  192. package/tests/CatalogProduct/Aggregate/CatalogProduct_GWT.res +11 -5
  193. package/tests/CatalogProduct/Aggregate/CatalogProduct_GWT.res.mjs +6 -5
  194. package/tests/CatalogProduct/ReadModel/AvailableProducts_GWT.res +2 -0
  195. package/tests/Customer/Aggregate/Customer_GWT.res +32 -17
  196. package/tests/Customer/Aggregate/Customer_GWT.res.mjs +31 -30
  197. package/tests/Customer/ReadModel/Customers_GWT.res +4 -0
  198. package/tests/Extension/Products_Extension_GWT.res +3 -2
  199. package/tests/Extension/Products_Extension_GWT.res.mjs +3 -5
  200. package/tests/ExtensionPoint/Orders_ExtensionPointMapping_GWT.res +5 -3
  201. package/tests/ExtensionPoint/Orders_ExtensionPointMapping_GWT.res.mjs +6 -16
  202. package/tests/Order/Aggregate/OrderMappings_GWT.res +4 -0
  203. package/tests/Order/Aggregate/Order_GWT.res +24 -5
  204. package/tests/Order/Aggregate/Order_GWT.res.mjs +6 -5
  205. package/tests/Order/ReadModel/Orders_GWT.res +4 -0
  206. package/tests/Ordering_Examples.res +13 -0
  207. package/tests/Ordering_Examples.res.mjs +35 -0
@@ -1,29 +1,35 @@
1
1
  @@reventless.gwt
2
2
 
3
+ open Ordering_Examples
4
+
3
5
  // Ids are typed; the literals are made once, here.
4
6
  let cust1 = CustomerId.make("cust-1")
5
7
  let prod1 = CatalogSpec.ProductId.make("prod-1")
6
8
  let prod2 = CatalogSpec.ProductId.make("prod-2")
7
9
 
8
10
  describe("Order Behavior", () => {
11
+ // scenario-id: 4f723805-10e2-4b72-b40a-6cf71e91c375
9
12
  test("Place on new aggregate produces Placed", () =>
10
13
  givenEvents([])
11
14
  ->whenCmd(Place({customerId: cust1, productIds: [prod1, prod2]}))
12
15
  ->thenEvent(Placed({customerId: cust1, productIds: [prod1, prod2]}))
13
16
  )
14
17
 
18
+ // scenario-id: 061fb189-7195-474f-8010-0a0339d7cf11
15
19
  test("Place on existing order returns OrderAlreadyPlaced", () =>
16
20
  givenEvents([Placed({customerId: cust1, productIds: [prod1]})])
17
21
  ->whenCmd(Place({customerId: cust1, productIds: [prod1]}))
18
22
  ->thenError(OrderAlreadyPlaced)
19
23
  )
20
24
 
25
+ // scenario-id: 3cb519a2-53ba-4f66-938f-2d5e4a3b736b
21
26
  test("Place on shipped order returns OrderAlreadyShipped", () =>
22
27
  givenEvents([Placed({customerId: cust1, productIds: [prod1]}), Shipped])
23
28
  ->whenCmd(Place({customerId: cust1, productIds: [prod1]}))
24
29
  ->thenError(OrderAlreadyShipped)
25
30
  )
26
31
 
32
+ // scenario-id: e74bad7c-abe6-4313-9290-b20f75897285
27
33
  test("Place on cancelled order returns OrderAlreadyCancelled", () =>
28
34
  givenEvents([
29
35
  Placed({customerId: cust1, productIds: [prod1]}),
@@ -33,24 +39,28 @@ describe("Order Behavior", () => {
33
39
  ->thenError(OrderAlreadyCancelled)
34
40
  )
35
41
 
42
+ // scenario-id: 1e97733f-32dd-473a-86e9-6c2cfec8f813
36
43
  test("Ship on non-existent order returns OrderNotFound", () =>
37
44
  givenEvents([])
38
45
  ->whenCmd(Ship)
39
46
  ->thenError(OrderNotFound)
40
47
  )
41
48
 
49
+ // scenario-id: 54073db7-f835-4d89-a648-71b6dc4869c2
42
50
  test("Ship on placed order produces Shipped", () =>
43
51
  givenEvents([Placed({customerId: cust1, productIds: [prod1]})])
44
52
  ->whenCmd(Ship)
45
53
  ->thenEvent(Shipped)
46
54
  )
47
55
 
56
+ // scenario-id: 2d4c200e-ece6-40c4-a67d-460f5beca59e
48
57
  test("Ship on shipped order produces no events (idempotent)", () =>
49
58
  givenEvents([Placed({customerId: cust1, productIds: [prod1]}), Shipped])
50
59
  ->whenCmd(Ship)
51
60
  ->thenNoEvent
52
61
  )
53
62
 
63
+ // scenario-id: 08783980-65d7-4114-b4ef-f0f95b0b3fc5
54
64
  test("Ship on cancelled order returns OrderAlreadyCancelled", () =>
55
65
  givenEvents([
56
66
  Placed({customerId: cust1, productIds: [prod1]}),
@@ -60,24 +70,28 @@ describe("Order Behavior", () => {
60
70
  ->thenError(OrderAlreadyCancelled)
61
71
  )
62
72
 
73
+ // scenario-id: 2104ec68-2de0-464b-b8f8-379f47b03db9
63
74
  test("Cancel on non-existent order returns OrderNotFound", () =>
64
75
  givenEvents([])
65
76
  ->whenCmd(Cancel)
66
77
  ->thenError(OrderNotFound)
67
78
  )
68
79
 
80
+ // scenario-id: 3d974a23-5eb6-4463-9824-e61b0fa5a278
69
81
  test("Cancel on placed order produces Cancelled", () =>
70
82
  givenEvents([Placed({customerId: cust1, productIds: [prod1]})])
71
83
  ->whenCmd(Cancel)
72
84
  ->thenEvent(Cancelled({productIds: [prod1]}))
73
85
  )
74
86
 
87
+ // scenario-id: 6144fcb7-d768-4237-9e67-e530c736210d
75
88
  test("Cancel on shipped order returns OrderAlreadyShipped", () =>
76
89
  givenEvents([Placed({customerId: cust1, productIds: [prod1]}), Shipped])
77
90
  ->whenCmd(Cancel)
78
91
  ->thenError(OrderAlreadyShipped)
79
92
  )
80
93
 
94
+ // scenario-id: 07679806-2e68-4cdb-b8c0-8cc67bd65fa7
81
95
  test("Cancel on cancelled order produces no events (idempotent)", () =>
82
96
  givenEvents([
83
97
  Placed({customerId: cust1, productIds: [prod1]}),
@@ -87,40 +101,45 @@ describe("Order Behavior", () => {
87
101
  ->thenNoEvent
88
102
  )
89
103
 
104
+ // scenario-id: aa624dbf-659b-4685-8695-4203e23a855f
90
105
  test("Refund on non-existent order returns OrderNotFound", () =>
91
106
  givenEvents([])
92
107
  ->whenCmd(Refund({reason: "lost-in-transit"}))
93
108
  ->thenError(OrderNotFound)
94
109
  )
95
110
 
111
+ // scenario-id: cf56897b-1cf0-4768-8ada-eae11c069d95
96
112
  test("Refund on placed order returns OrderNotCancelled", () =>
97
113
  givenEvents([Placed({customerId: cust1, productIds: [prod1]})])
98
- ->whenCmd(Refund({reason: "customer-changed-mind"}))
114
+ ->whenCmd(Refund({reason: changedMind}))
99
115
  ->thenError(OrderNotCancelled)
100
116
  )
101
117
 
118
+ // scenario-id: 802fb4a7-3768-4c6d-8a54-444f44891515
102
119
  test("Refund on shipped order returns OrderNotCancelled", () =>
103
120
  givenEvents([Placed({customerId: cust1, productIds: [prod1]}), Shipped])
104
121
  ->whenCmd(Refund({reason: "delivered-damaged"}))
105
122
  ->thenError(OrderNotCancelled)
106
123
  )
107
124
 
125
+ // scenario-id: d9f7692d-4d64-41d9-b845-f5958fe95bc0
108
126
  test("Refund on cancelled order produces Refunded", () =>
109
127
  givenEvents([
110
128
  Placed({customerId: cust1, productIds: [prod1]}),
111
129
  Cancelled({productIds: [prod1]}),
112
130
  ])
113
- ->whenCmd(Refund({reason: "customer-changed-mind"}))
114
- ->thenEvent(Refunded({reason: "customer-changed-mind"}))
131
+ ->whenCmd(Refund({reason: changedMind}))
132
+ ->thenEvent(Refunded({reason: changedMind}))
115
133
  )
116
134
 
135
+ // scenario-id: 4ced8701-2214-4f05-89ed-057b130979ad
117
136
  test("Refund on already-refunded order produces no events (idempotent)", () =>
118
137
  givenEvents([
119
138
  Placed({customerId: cust1, productIds: [prod1]}),
120
139
  Cancelled({productIds: [prod1]}),
121
- Refunded({reason: "customer-changed-mind"}),
140
+ Refunded({reason: changedMind}),
122
141
  ])
123
- ->whenCmd(Refund({reason: "customer-changed-mind"}))
142
+ ->whenCmd(Refund({reason: changedMind}))
124
143
  ->thenNoEvent
125
144
  )
126
145
  })
@@ -5,6 +5,7 @@ import * as ProductId$CatalogSpec from "@reventlessdev/online-shop-aggregates-ca
5
5
  import * as CustomerId$OrderingPlugin from "../../../src/Customer/CustomerId.res.mjs";
6
6
  import * as Behavior_GWT$ReventlessGwt from "@reventlessdev/reventless-gwt/src/Behavior_GWT.res.mjs";
7
7
  import * as Order_Behavior$OrderingPlugin from "../../../src/Order/Aggregate/Order_Behavior.res.mjs";
8
+ import * as Ordering_Examples$OrderingPlugin from "../../Ordering_Examples.res.mjs";
8
9
 
9
10
  let include = Behavior_GWT$ReventlessGwt.MakeFromAggregate({
10
11
  name: Order$OrderingPlugin.name,
@@ -160,7 +161,7 @@ describe("Order Behavior", () => {
160
161
  productIds: [prod1]
161
162
  }]), {
162
163
  TAG: "Refund",
163
- reason: "customer-changed-mind"
164
+ reason: Ordering_Examples$OrderingPlugin.changedMind
164
165
  }), "OrderNotCancelled"));
165
166
  test("Refund on shipped order returns OrderNotCancelled", () => thenError(whenCmd(givenEvents([
166
167
  {
@@ -185,10 +186,10 @@ describe("Order Behavior", () => {
185
186
  }
186
187
  ]), {
187
188
  TAG: "Refund",
188
- reason: "customer-changed-mind"
189
+ reason: Ordering_Examples$OrderingPlugin.changedMind
189
190
  }), {
190
191
  TAG: "Refunded",
191
- reason: "customer-changed-mind"
192
+ reason: Ordering_Examples$OrderingPlugin.changedMind
192
193
  }));
193
194
  test("Refund on already-refunded order produces no events (idempotent)", () => thenNoEvent(whenCmd(givenEvents([
194
195
  {
@@ -202,11 +203,11 @@ describe("Order Behavior", () => {
202
203
  },
203
204
  {
204
205
  TAG: "Refunded",
205
- reason: "customer-changed-mind"
206
+ reason: Ordering_Examples$OrderingPlugin.changedMind
206
207
  }
207
208
  ]), {
208
209
  TAG: "Refund",
209
- reason: "customer-changed-mind"
210
+ reason: Ordering_Examples$OrderingPlugin.changedMind
210
211
  })));
211
212
  });
212
213
 
@@ -6,6 +6,7 @@ let prod1 = CatalogSpec.ProductId.make("prod-1")
6
6
  let prod2 = CatalogSpec.ProductId.make("prod-2")
7
7
 
8
8
  describe("Orders ReadModel ← Order", () => {
9
+ // scenario-id: 94f5938c-adf9-42c2-8986-1204e0aa0710
9
10
  test("Placed sets initial read model state", () =>
10
11
  givenEvents([])
11
12
  ->whenEvent(Order.Placed({customerId: cust1, productIds: [prod1, prod2]}))
@@ -16,6 +17,7 @@ describe("Orders ReadModel ← Order", () => {
16
17
  })
17
18
  )
18
19
 
20
+ // scenario-id: 4b7e916e-e7db-4c00-9337-9e2fe4104c93
19
21
  test("Shipped updates status", () =>
20
22
  givenEvents([Order.Placed({customerId: cust1, productIds: [prod1]})])
21
23
  ->whenEvent(Order.Shipped)
@@ -26,6 +28,7 @@ describe("Orders ReadModel ← Order", () => {
26
28
  })
27
29
  )
28
30
 
31
+ // scenario-id: a56314fa-907f-425a-80e6-a7ea1a27d6c9
29
32
  test("Cancelled updates status", () =>
30
33
  givenEvents([Order.Placed({customerId: cust1, productIds: [prod1]})])
31
34
  ->whenEvent(Order.Cancelled({productIds: [prod1]}))
@@ -36,6 +39,7 @@ describe("Orders ReadModel ← Order", () => {
36
39
  })
37
40
  )
38
41
 
42
+ // scenario-id: 96902cd1-2eae-4a35-b5c6-6d28dc9acda7
39
43
  test("Refunded updates status", () =>
40
44
  givenEvents([
41
45
  Order.Placed({customerId: cust1, productIds: [prod1]}),
@@ -0,0 +1,13 @@
1
+ @@reventless.examples
2
+
3
+ let p1: CatalogSpec.ProductId.t = CatalogSpec.ProductId.makeFromString("p1")
4
+ let p2: CatalogSpec.ProductId.t = CatalogSpec.ProductId.makeFromString("p2")
5
+
6
+ let c1: CustomerId.t = CustomerId.makeFromString("c1")
7
+
8
+ let aliceEmail: string = "alice@example.com"
9
+ let bobEmail: string = "bob@example.com"
10
+ let changedMind: string = "customer-changed-mind"
11
+ let laptop: string = "Laptop"
12
+ let mainStreet: string = "123 Main St"
13
+ let oakAvenue: string = "456 Oak Ave"
@@ -0,0 +1,35 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as ProductId$CatalogSpec from "@reventlessdev/online-shop-aggregates-catalog-spec/src/ProductId.res.mjs";
4
+ import * as CustomerId$OrderingPlugin from "../src/Customer/CustomerId.res.mjs";
5
+
6
+ let p1 = ProductId$CatalogSpec.makeFromString("p1");
7
+
8
+ let p2 = ProductId$CatalogSpec.makeFromString("p2");
9
+
10
+ let c1 = CustomerId$OrderingPlugin.makeFromString("c1");
11
+
12
+ let aliceEmail = "alice@example.com";
13
+
14
+ let bobEmail = "bob@example.com";
15
+
16
+ let changedMind = "customer-changed-mind";
17
+
18
+ let laptop = "Laptop";
19
+
20
+ let mainStreet = "123 Main St";
21
+
22
+ let oakAvenue = "456 Oak Ave";
23
+
24
+ export {
25
+ p1,
26
+ p2,
27
+ c1,
28
+ aliceEmail,
29
+ bobEmail,
30
+ changedMind,
31
+ laptop,
32
+ mainStreet,
33
+ oakAvenue,
34
+ }
35
+ /* p1 Not a pure module */