@@ -99,72 +99,6 @@ def test_given_three_items_are_added_when_forth_item_is_added_then_the_last__ite
9999 )
100100 ) { add_item ( order_id , product_id ) }
101101
102- assert_events (
103- stream ,
104- PriceItemAdded . new (
105- data : {
106- order_id : order_id ,
107- product_id : product_id ,
108- base_price : 20 ,
109- price : 0 ,
110- base_total_value : 80 ,
111- total_value : 60 ,
112- }
113- ) ,
114- OrderTotalValueCalculated . new (
115- data : {
116- order_id : order_id ,
117- discounted_amount : 60 ,
118- total_amount : 80
119- }
120- ) ,
121- PriceItemValueCalculated . new (
122- data : {
123- order_id : order_id ,
124- product_id : product_id ,
125- quantity : 4 ,
126- amount : 80 ,
127- discounted_amount : 60 ,
128- }
129- )
130- ) { add_item ( order_id , product_id ) }
131- end
132-
133- def test_given_3_plus_one__when_10_percent_discount_for_offer__then_offer_price_includes_both_discounts
134- product_id = SecureRandom . uuid
135- set_price ( product_id , 20 )
136- order_id = SecureRandom . uuid
137- stream = "Pricing::Offer$#{ order_id } "
138- assert_events (
139- stream ,
140- PriceItemAdded . new (
141- data : {
142- order_id : order_id ,
143- product_id : product_id ,
144- base_price : 20 ,
145- price : 20 ,
146- base_total_value : 20 ,
147- total_value : 20 ,
148- }
149- ) ,
150- OrderTotalValueCalculated . new (
151- data : {
152- order_id : order_id ,
153- discounted_amount : 20 ,
154- total_amount : 20
155- }
156- ) ,
157- PriceItemValueCalculated . new (
158- data : {
159- order_id : order_id ,
160- product_id : product_id ,
161- quantity : 1 ,
162- amount : 20 ,
163- discounted_amount : 20 ,
164- }
165- )
166- ) { add_item ( order_id , product_id ) }
167-
168102 assert_events (
169103 stream ,
170104 PriceItemAdded . new (
@@ -173,74 +107,21 @@ def test_given_3_plus_one__when_10_percent_discount_for_offer__then_offer_price_
173107 product_id : product_id ,
174108 base_price : 20 ,
175109 price : 20 ,
176- base_total_value : 40 ,
177- total_value : 40 ,
178- }
179- ) ,
180- OrderTotalValueCalculated . new (
181- data : {
182- order_id : order_id ,
183- discounted_amount : 40 ,
184- total_amount : 40
185- }
186- ) ,
187- PriceItemValueCalculated . new (
188- data : {
189- order_id : order_id ,
190- product_id : product_id ,
191- quantity : 2 ,
192- amount : 40 ,
193- discounted_amount : 40 ,
194- }
195- )
196- ) { add_item ( order_id , product_id ) }
197-
198- assert_events (
199- stream ,
200- PriceItemAdded . new (
201- data : {
202- order_id : order_id ,
203- product_id : product_id ,
204- base_price : 20 ,
205- price : 20 ,
206- base_total_value : 60 ,
207- total_value : 60 ,
208- }
209- ) ,
210- OrderTotalValueCalculated . new (
211- data : {
212- order_id : order_id ,
213- discounted_amount : 60 ,
214- total_amount : 60
110+ base_total_value : 80 ,
111+ total_value : 80 ,
215112 }
216113 ) ,
217- PriceItemValueCalculated . new (
218- data : {
219- order_id : order_id ,
220- product_id : product_id ,
221- quantity : 3 ,
222- amount : 60 ,
223- discounted_amount : 60 ,
224- }
225- )
226- ) { add_item ( order_id , product_id ) }
227-
228- assert_events (
229- stream ,
230- PriceItemAdded . new (
114+ DiscountApplied . new (
231115 data : {
232116 order_id : order_id ,
233- product_id : product_id ,
234- base_price : 20 ,
235- price : 0 ,
236117 base_total_value : 80 ,
237118 total_value : 60 ,
238119 }
239120 ) ,
240121 OrderTotalValueCalculated . new (
241122 data : {
242123 order_id : order_id ,
243- discounted_amount : 60 ,
124+ discounted_amount : 80 ,
244125 total_amount : 80
245126 }
246127 ) ,
@@ -250,7 +131,7 @@ def test_given_3_plus_one__when_10_percent_discount_for_offer__then_offer_price_
250131 product_id : product_id ,
251132 quantity : 4 ,
252133 amount : 80 ,
253- discounted_amount : 60 ,
134+ discounted_amount : 80 ,
254135 }
255136 )
256137 ) { add_item ( order_id , product_id ) }
0 commit comments