@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.
- package/CHANGELOG.md +16 -0
- package/lib/bs/.compiler.log +2 -2
- package/lib/bs/OrderingPlugin.cmi +0 -0
- package/lib/bs/OrderingPlugin.cmt +0 -0
- package/lib/bs/OrderingPlugin.mlmap +1 -0
- package/lib/bs/compiler-info.json +1 -1
- package/lib/bs/src/CatalogProduct/Aggregate/CatalogProduct-OrderingPlugin.cmi +0 -0
- package/lib/bs/src/CatalogProduct/Aggregate/CatalogProduct-OrderingPlugin.cmt +0 -0
- package/lib/bs/src/CatalogProduct/Aggregate/CatalogProduct_Behavior-OrderingPlugin.cmi +0 -0
- package/lib/bs/src/CatalogProduct/Aggregate/CatalogProduct_Behavior-OrderingPlugin.cmt +0 -0
- package/lib/bs/src/CatalogProduct/ReadModel/AvailableProducts-OrderingPlugin.cmi +0 -0
- package/lib/bs/src/CatalogProduct/ReadModel/AvailableProducts-OrderingPlugin.cmt +0 -0
- package/lib/bs/src/CatalogProduct/ReadModel/AvailableProducts_Projections-OrderingPlugin.cmi +0 -0
- package/lib/bs/src/CatalogProduct/ReadModel/AvailableProducts_Projections-OrderingPlugin.cmt +0 -0
- package/lib/bs/src/Customer/Aggregate/Customer-OrderingPlugin.cmi +0 -0
- package/lib/bs/src/Customer/Aggregate/Customer-OrderingPlugin.cmt +0 -0
- package/lib/bs/src/Customer/Aggregate/Customer_Behavior-OrderingPlugin.cmi +0 -0
- package/lib/bs/src/Customer/Aggregate/Customer_Behavior-OrderingPlugin.cmt +0 -0
- package/lib/bs/src/Customer/CustomerId-OrderingPlugin.cmi +0 -0
- package/lib/bs/src/Customer/CustomerId-OrderingPlugin.cmt +0 -0
- package/lib/bs/src/Customer/ReadModel/Customers-OrderingPlugin.cmi +0 -0
- package/lib/bs/src/Customer/ReadModel/Customers-OrderingPlugin.cmt +0 -0
- package/lib/bs/src/Customer/ReadModel/Customers_Projections-OrderingPlugin.cmi +0 -0
- package/lib/bs/src/Customer/ReadModel/Customers_Projections-OrderingPlugin.cmt +0 -0
- package/lib/bs/src/Extension/Products_Extension-OrderingPlugin.cmi +0 -0
- package/lib/bs/src/Extension/Products_Extension-OrderingPlugin.cmt +0 -0
- package/lib/bs/src/ExtensionPoint/Orders_ExtensionPointMapping-OrderingPlugin.cmi +0 -0
- package/lib/bs/src/ExtensionPoint/Orders_ExtensionPointMapping-OrderingPlugin.cmt +0 -0
- package/lib/bs/src/LifecycleModel-OrderingPlugin.cmi +0 -0
- package/lib/bs/src/LifecycleModel-OrderingPlugin.cmt +0 -0
- package/lib/bs/src/Order/Aggregate/Order-OrderingPlugin.cmi +0 -0
- package/lib/bs/src/Order/Aggregate/Order-OrderingPlugin.cmt +0 -0
- package/lib/bs/src/Order/Aggregate/Order_Behavior-OrderingPlugin.cmi +0 -0
- package/lib/bs/src/Order/Aggregate/Order_Behavior-OrderingPlugin.cmt +0 -0
- package/lib/bs/src/Order/Aggregate/Order_Mappings-OrderingPlugin.cmi +0 -0
- package/lib/bs/src/Order/Aggregate/Order_Mappings-OrderingPlugin.cmt +0 -0
- package/lib/bs/src/Order/OrderId-OrderingPlugin.cmi +0 -0
- package/lib/bs/src/Order/OrderId-OrderingPlugin.cmt +0 -0
- package/lib/bs/src/Order/ReadModel/Orders-OrderingPlugin.cmi +0 -0
- package/lib/bs/src/Order/ReadModel/Orders-OrderingPlugin.cmt +0 -0
- package/lib/bs/src/Order/ReadModel/Orders_Projections-OrderingPlugin.cmi +0 -0
- package/lib/bs/src/Order/ReadModel/Orders_Projections-OrderingPlugin.cmt +0 -0
- package/lib/bs/src/Order/SideEffect/Order_EmailNotification-OrderingPlugin.cmi +0 -0
- package/lib/bs/src/Order/SideEffect/Order_EmailNotification-OrderingPlugin.cmt +0 -0
- package/lib/bs/src/Plugin-OrderingPlugin.cmi +0 -0
- package/lib/bs/src/Plugin-OrderingPlugin.cmt +0 -0
- package/lib/bs/src/Task/OrderNotifications-OrderingPlugin.cmi +0 -0
- package/lib/bs/src/Task/OrderNotifications-OrderingPlugin.cmt +0 -0
- package/lib/bs/tests/CatalogProduct/Aggregate/CatalogProduct_GWT-OrderingPlugin.cmi +0 -0
- package/lib/bs/tests/CatalogProduct/Aggregate/CatalogProduct_GWT-OrderingPlugin.cmt +0 -0
- package/lib/bs/tests/CatalogProduct/Aggregate/CatalogProduct_GWT.ast +0 -0
- package/lib/bs/tests/CatalogProduct/Aggregate/CatalogProduct_GWT.res +11 -5
- package/lib/bs/tests/CatalogProduct/Aggregate/CatalogProduct_GWT.res.mjs +6 -5
- package/lib/bs/tests/CatalogProduct/ReadModel/AvailableProducts_GWT-OrderingPlugin.cmi +0 -0
- package/lib/bs/tests/CatalogProduct/ReadModel/AvailableProducts_GWT-OrderingPlugin.cmt +0 -0
- package/lib/bs/tests/CatalogProduct/ReadModel/AvailableProducts_GWT.ast +0 -0
- package/lib/bs/tests/CatalogProduct/ReadModel/AvailableProducts_GWT.res +2 -0
- package/lib/bs/tests/Customer/Aggregate/Customer_GWT-OrderingPlugin.cmi +0 -0
- package/lib/bs/tests/Customer/Aggregate/Customer_GWT-OrderingPlugin.cmt +0 -0
- package/lib/bs/tests/Customer/Aggregate/Customer_GWT.ast +0 -0
- package/lib/bs/tests/Customer/Aggregate/Customer_GWT.res +32 -17
- package/lib/bs/tests/Customer/Aggregate/Customer_GWT.res.mjs +31 -30
- package/lib/bs/tests/Customer/ReadModel/Customers_GWT-OrderingPlugin.cmi +0 -0
- package/lib/bs/tests/Customer/ReadModel/Customers_GWT-OrderingPlugin.cmt +0 -0
- package/lib/bs/tests/Customer/ReadModel/Customers_GWT.ast +0 -0
- package/lib/bs/tests/Customer/ReadModel/Customers_GWT.res +4 -0
- package/lib/bs/tests/Extension/Products_Extension_GWT-OrderingPlugin.cmi +0 -0
- package/lib/bs/tests/Extension/Products_Extension_GWT-OrderingPlugin.cmt +0 -0
- package/lib/bs/tests/Extension/Products_Extension_GWT.ast +0 -0
- package/lib/bs/tests/Extension/Products_Extension_GWT.res +3 -2
- package/lib/bs/tests/Extension/Products_Extension_GWT.res.mjs +3 -5
- package/lib/bs/tests/ExtensionPoint/Orders_ExtensionPointMapping_GWT-OrderingPlugin.cmi +0 -0
- package/lib/bs/tests/ExtensionPoint/Orders_ExtensionPointMapping_GWT-OrderingPlugin.cmt +0 -0
- package/lib/bs/tests/ExtensionPoint/Orders_ExtensionPointMapping_GWT.ast +0 -0
- package/lib/bs/tests/ExtensionPoint/Orders_ExtensionPointMapping_GWT.res +5 -3
- package/lib/bs/tests/ExtensionPoint/Orders_ExtensionPointMapping_GWT.res.mjs +6 -16
- package/lib/bs/tests/Order/Aggregate/OrderMappings_GWT-OrderingPlugin.cmi +0 -0
- package/lib/bs/tests/Order/Aggregate/OrderMappings_GWT-OrderingPlugin.cmt +0 -0
- package/lib/bs/tests/Order/Aggregate/OrderMappings_GWT.ast +0 -0
- package/lib/bs/tests/Order/Aggregate/OrderMappings_GWT.res +4 -0
- package/lib/bs/tests/Order/Aggregate/Order_GWT-OrderingPlugin.cmi +0 -0
- package/lib/bs/tests/Order/Aggregate/Order_GWT-OrderingPlugin.cmt +0 -0
- package/lib/bs/tests/Order/Aggregate/Order_GWT.ast +0 -0
- package/lib/bs/tests/Order/Aggregate/Order_GWT.res +24 -5
- package/lib/bs/tests/Order/Aggregate/Order_GWT.res.mjs +6 -5
- package/lib/bs/tests/Order/ReadModel/Orders_GWT-OrderingPlugin.cmi +0 -0
- package/lib/bs/tests/Order/ReadModel/Orders_GWT-OrderingPlugin.cmt +0 -0
- package/lib/bs/tests/Order/ReadModel/Orders_GWT.ast +0 -0
- package/lib/bs/tests/Order/ReadModel/Orders_GWT.res +4 -0
- package/lib/bs/tests/Order/SideEffect/EmailService_Mock-OrderingPlugin.cmi +0 -0
- package/lib/bs/tests/Order/SideEffect/EmailService_Mock-OrderingPlugin.cmt +0 -0
- package/lib/bs/tests/Order/SideEffect/Order_EmailNotification_GWT-OrderingPlugin.cmi +0 -0
- package/lib/bs/tests/Order/SideEffect/Order_EmailNotification_GWT-OrderingPlugin.cmt +0 -0
- package/lib/bs/tests/Ordering_Examples-OrderingPlugin.cmi +0 -0
- package/lib/bs/tests/Ordering_Examples-OrderingPlugin.cmj +0 -0
- package/lib/bs/tests/Ordering_Examples-OrderingPlugin.cmt +0 -0
- package/lib/bs/tests/Ordering_Examples.ast +0 -0
- package/lib/bs/tests/Ordering_Examples.res +13 -0
- package/lib/bs/tests/Ordering_Examples.res.mjs +35 -0
- package/lib/ocaml/.compiler.log +2 -2
- package/lib/ocaml/AvailableProducts-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/AvailableProducts-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/AvailableProducts_GWT-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/AvailableProducts_GWT-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/AvailableProducts_GWT.ast +0 -0
- package/lib/ocaml/AvailableProducts_GWT.res +2 -0
- package/lib/ocaml/AvailableProducts_Projections-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/AvailableProducts_Projections-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/CatalogProduct-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/CatalogProduct-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/CatalogProduct_Behavior-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/CatalogProduct_Behavior-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/CatalogProduct_GWT-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/CatalogProduct_GWT-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/CatalogProduct_GWT.ast +0 -0
- package/lib/ocaml/CatalogProduct_GWT.res +11 -5
- package/lib/ocaml/Customer-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/Customer-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/CustomerId-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/CustomerId-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/Customer_Behavior-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/Customer_Behavior-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/Customer_GWT-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/Customer_GWT-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/Customer_GWT.ast +0 -0
- package/lib/ocaml/Customer_GWT.res +32 -17
- package/lib/ocaml/Customers-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/Customers-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/Customers_GWT-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/Customers_GWT-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/Customers_GWT.ast +0 -0
- package/lib/ocaml/Customers_GWT.res +4 -0
- package/lib/ocaml/Customers_Projections-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/Customers_Projections-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/EmailService_Mock-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/EmailService_Mock-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/LifecycleModel-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/LifecycleModel-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/Order-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/Order-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/OrderId-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/OrderId-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/OrderMappings_GWT-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/OrderMappings_GWT-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/OrderMappings_GWT.ast +0 -0
- package/lib/ocaml/OrderMappings_GWT.res +4 -0
- package/lib/ocaml/OrderNotifications-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/OrderNotifications-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/Order_Behavior-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/Order_Behavior-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/Order_EmailNotification-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/Order_EmailNotification-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/Order_EmailNotification_GWT-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/Order_EmailNotification_GWT-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/Order_GWT-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/Order_GWT-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/Order_GWT.ast +0 -0
- package/lib/ocaml/Order_GWT.res +24 -5
- package/lib/ocaml/Order_Mappings-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/Order_Mappings-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/OrderingPlugin.cmi +0 -0
- package/lib/ocaml/OrderingPlugin.cmt +0 -0
- package/lib/ocaml/OrderingPlugin.mlmap +1 -0
- package/lib/ocaml/Ordering_Examples-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/Ordering_Examples-OrderingPlugin.cmj +0 -0
- package/lib/ocaml/Ordering_Examples-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/Ordering_Examples.ast +0 -0
- package/lib/ocaml/Ordering_Examples.res +13 -0
- package/lib/ocaml/Orders-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/Orders-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/Orders_ExtensionPointMapping-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/Orders_ExtensionPointMapping-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/Orders_ExtensionPointMapping_GWT-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/Orders_ExtensionPointMapping_GWT-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/Orders_ExtensionPointMapping_GWT.ast +0 -0
- package/lib/ocaml/Orders_ExtensionPointMapping_GWT.res +5 -3
- package/lib/ocaml/Orders_GWT-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/Orders_GWT-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/Orders_GWT.ast +0 -0
- package/lib/ocaml/Orders_GWT.res +4 -0
- package/lib/ocaml/Orders_Projections-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/Orders_Projections-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/Plugin-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/Plugin-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/Products_Extension-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/Products_Extension-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/Products_Extension_GWT-OrderingPlugin.cmi +0 -0
- package/lib/ocaml/Products_Extension_GWT-OrderingPlugin.cmt +0 -0
- package/lib/ocaml/Products_Extension_GWT.ast +0 -0
- package/lib/ocaml/Products_Extension_GWT.res +3 -2
- package/package.json +8 -8
- package/tests/CatalogProduct/Aggregate/CatalogProduct_GWT.res +11 -5
- package/tests/CatalogProduct/Aggregate/CatalogProduct_GWT.res.mjs +6 -5
- package/tests/CatalogProduct/ReadModel/AvailableProducts_GWT.res +2 -0
- package/tests/Customer/Aggregate/Customer_GWT.res +32 -17
- package/tests/Customer/Aggregate/Customer_GWT.res.mjs +31 -30
- package/tests/Customer/ReadModel/Customers_GWT.res +4 -0
- package/tests/Extension/Products_Extension_GWT.res +3 -2
- package/tests/Extension/Products_Extension_GWT.res.mjs +3 -5
- package/tests/ExtensionPoint/Orders_ExtensionPointMapping_GWT.res +5 -3
- package/tests/ExtensionPoint/Orders_ExtensionPointMapping_GWT.res.mjs +6 -16
- package/tests/Order/Aggregate/OrderMappings_GWT.res +4 -0
- package/tests/Order/Aggregate/Order_GWT.res +24 -5
- package/tests/Order/Aggregate/Order_GWT.res.mjs +6 -5
- package/tests/Order/ReadModel/Orders_GWT.res +4 -0
- package/tests/Ordering_Examples.res +13 -0
- 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:
|
|
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:
|
|
114
|
-
->thenEvent(Refunded({reason:
|
|
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:
|
|
140
|
+
Refunded({reason: changedMind}),
|
|
122
141
|
])
|
|
123
|
-
->whenCmd(Refund({reason:
|
|
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:
|
|
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:
|
|
189
|
+
reason: Ordering_Examples$OrderingPlugin.changedMind
|
|
189
190
|
}), {
|
|
190
191
|
TAG: "Refunded",
|
|
191
|
-
reason:
|
|
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:
|
|
206
|
+
reason: Ordering_Examples$OrderingPlugin.changedMind
|
|
206
207
|
}
|
|
207
208
|
]), {
|
|
208
209
|
TAG: "Refund",
|
|
209
|
-
reason:
|
|
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 */
|