[purchasing] Remove fulfillRequest() from test
This commit is contained in:
parent
dc95c863d2
commit
ac6d17e895
|
@ -89,6 +89,21 @@ method getHost(market: MockMarket,
|
|||
return some slot.host
|
||||
return none Address
|
||||
|
||||
proc emitSlotFilled*(market: MockMarket,
|
||||
requestId: array[32, byte],
|
||||
slotIndex: UInt256) =
|
||||
var subscriptions = market.subscriptions.onSlotFilled
|
||||
for subscription in subscriptions:
|
||||
if subscription.requestId == requestId and
|
||||
subscription.slotIndex == slotIndex:
|
||||
subscription.callback(requestId, slotIndex)
|
||||
|
||||
proc emitRequestFulfilled*(market: MockMarket, requestId: array[32, byte]) =
|
||||
var subscriptions = market.subscriptions.onFulfillment
|
||||
for subscription in subscriptions:
|
||||
if subscription.requestId == requestId:
|
||||
subscription.callback(requestId)
|
||||
|
||||
proc fillSlot*(market: MockMarket,
|
||||
requestId: array[32, byte],
|
||||
slotIndex: UInt256,
|
||||
|
@ -101,11 +116,7 @@ proc fillSlot*(market: MockMarket,
|
|||
host: host
|
||||
)
|
||||
market.filled.add(slot)
|
||||
var subscriptions = market.subscriptions.onSlotFilled
|
||||
for subscription in subscriptions:
|
||||
if subscription.requestId == requestId and
|
||||
subscription.slotIndex == slotIndex:
|
||||
subscription.callback(requestId, slotIndex)
|
||||
market.emitSlotFilled(requestId, slotIndex)
|
||||
|
||||
method fillSlot*(market: MockMarket,
|
||||
requestId: array[32, byte],
|
||||
|
|
|
@ -74,8 +74,7 @@ suite "Purchasing":
|
|||
test "succeeds when request is fulfilled":
|
||||
let purchase = purchasing.purchase(request)
|
||||
let request = market.requested[0]
|
||||
let proof = seq[byte].example
|
||||
await market.fulfillRequest(request.id, proof)
|
||||
market.emitRequestFulfilled(request.id)
|
||||
await purchase.wait()
|
||||
check purchase.error.isNone
|
||||
|
||||
|
|
Loading…
Reference in New Issue