Skip to content

Commit 781477d

Browse files
committed
Kill mutant
1 parent 1b4fa5a commit 781477d

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

ecommerce/pricing/test/multiple_promotion_test.rb

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,65 @@ def test_given_multiple_discounts_applied_when_time_promotion_is_removed_then_ot
6161
) { run_command(RemovePercentageDiscount.new(order_id: order_id)) }
6262
end
6363

64+
65+
def test_given_multiple_discounts_applied_when_time_promotion_is_removed_then_first_promotion_is_applied
66+
order_id = SecureRandom.uuid
67+
product_id = SecureRandom.uuid
68+
69+
given(
70+
[
71+
TimePromotionCreated.new(
72+
data: {
73+
time_promotion_id: SecureRandom.uuid,
74+
discount: 10,
75+
start_time: Time.current - 1,
76+
end_time: Time.current + 1
77+
}
78+
),
79+
Pricing::PriceItemAdded.new(
80+
data: {
81+
product_id: product_id,
82+
order_id: order_id,
83+
base_price: 1000,
84+
price: 1000,
85+
base_total_value: 1000,
86+
total_value: 1000
87+
}
88+
),
89+
PercentageDiscountSet.new(
90+
data: {
91+
order_id: order_id,
92+
type: Discounts::TIME_PROMOTION_DISCOUNT,
93+
amount: 10,
94+
base_total_value: 1000,
95+
total_value: 900
96+
}
97+
),
98+
PercentageDiscountSet.new(
99+
data: {
100+
order_id: order_id,
101+
type: Discounts::GENERAL_DISCOUNT,
102+
amount: 50,
103+
base_total_value: 1000,
104+
total_value: 450
105+
}
106+
)
107+
]
108+
)
109+
110+
assert_events(
111+
stream_name(order_id),
112+
PercentageDiscountRemoved.new(
113+
data: {
114+
order_id: order_id,
115+
type: Discounts::TIME_PROMOTION_DISCOUNT,
116+
base_total_value: 1000,
117+
total_value: 1000
118+
}
119+
),
120+
) { run_command(RemoveTimePromotionDiscount.new(order_id: order_id)) }
121+
end
122+
64123
private
65124

66125
def given(events)

0 commit comments

Comments
 (0)