@@ -20,15 +20,22 @@ suite "sales state 'unknown'":
2020 let slotId = slotId (request.id, slotIndex)
2121
2222 var market: MockMarket
23+ var context: SalesContext
2324 var agent: SalesAgent
2425 var state: SaleUnknown
2526
2627 setup:
2728 market = MockMarket .new ()
28- let context = SalesContext (market: market)
29- agent = newSalesAgent (context, request.id, slotIndex, StorageRequest .none )
29+ context = SalesContext (market: market)
30+ agent = newSalesAgent (context, request.id, slotIndex, request.some )
3031 state = SaleUnknown .new ()
3132
33+ test " switches to error state when the request cannot be retrieved" :
34+ agent = newSalesAgent (context, request.id, slotIndex, StorageRequest .none)
35+ let next = await state.run (agent)
36+ check ! next of SaleErrored
37+ check SaleErrored (! next).error.msg == " request could not be retrieved"
38+
3239 test " switches to error state when on chain state cannot be fetched" :
3340 let next = await state.run (agent)
3441 check ! next of SaleErrored
@@ -37,6 +44,7 @@ suite "sales state 'unknown'":
3744 market.slotState[slotId] = SlotState .Free
3845 let next = await state.run (agent)
3946 check ! next of SaleErrored
47+ check SaleErrored (! next).error.msg == " Slot state on chain should not be 'free'"
4048
4149 test " switches to filled state when on chain state is 'filled'" :
4250 market.slotState[slotId] = SlotState .Filled
0 commit comments