Deliver paid kits in the active MySQL inventory transaction
All checks were successful
DuneRealms Kit Delivery CI / kits (push) Successful in 54s
All checks were successful
DuneRealms Kit Delivery CI / kits (push) Successful in 54s
This commit is contained in:
parent
d5edec1907
commit
976ce1c2fc
1 changed files with 54 additions and 9 deletions
|
|
@ -0,0 +1,22 @@
|
|||
package com.example.dunekits;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class KitDeliverySQLTest {
|
||||
@Test void mysqlRequiresPaidRequestedBuyerBoundReceiptsThroughoutTheTransaction() {
|
||||
for (String sql : new String[]{KitDeliverySQL.pending(true), KitDeliverySQL.lock(true), KitDeliverySQL.acknowledge(true)}) {
|
||||
assertTrue(sql.contains("dune_kit_sales"));assertTrue(sql.contains("buyer_uuid=?"));
|
||||
assertTrue(sql.contains("quantity=1"));assertTrue(sql.contains("gross_cents>0"));
|
||||
assertTrue(sql.contains("completed_at>0"));assertTrue(sql.contains("redeem_requested_at>0"));
|
||||
assertTrue(sql.contains("delivered_at IS NULL"));
|
||||
}
|
||||
assertTrue(KitDeliverySQL.lock(true).endsWith("FOR UPDATE"));
|
||||
assertTrue(KitDeliverySQL.lock(true).contains("SHA2(snapshot_json,256)"));
|
||||
assertFalse(KitDeliverySQL.acknowledge(true).contains("dune_kit_deliveries"));
|
||||
}
|
||||
@Test void postgresKeepsItsBuyerBoundInventoryOutboxSeparate() {
|
||||
assertTrue(KitDeliverySQL.lock(false).endsWith("FOR UPDATE"));
|
||||
assertTrue(KitDeliverySQL.acknowledge(false).contains("buyer_uuid=? AND delivered_at IS NULL"));
|
||||
assertFalse(KitDeliverySQL.pending(false).contains("dune_kit_sales"));
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue

Staff