- feature
- shop-paid
Shop: a paid order takes stock¶
Paying o-1003 takes one pour-over cone and one decaf off stock, once.
$val o = dom.find (cls = "Order", key = "o-1003")
$send dom.upsert (cls = "Order", entity = o + {status: "paid", stockTaken: false})
▶ Try$send shop.orderChanged (key = "o-1003")
▶ Try$val cone = dom.find (cls = "Product", key = "pour-over")
$expect cone.stock == 1
▶ Try$val decaf = dom.find (cls = "Product", key = "coffee-decaf")
$expect decaf.stock == 2
▶ Try$val after = dom.find (cls = "Order", key = "o-1003")
$expect after.stockTaken
▶ Try$send shop.orderChanged (key = "o-1003")
▶ Try$val again = dom.find (cls = "Product", key = "pour-over")
$expect again.stock == 1
▶ Try