[purchasing] rename requests -> requested
This commit is contained in:
parent
7c9c244836
commit
04c291b05c
|
@ -2,7 +2,7 @@ import pkg/dagger/market
|
||||||
|
|
||||||
type
|
type
|
||||||
MockMarket* = ref object of Market
|
MockMarket* = ref object of Market
|
||||||
requests*: seq[StorageRequest]
|
requested*: seq[StorageRequest]
|
||||||
|
|
||||||
method requestStorage*(market: MockMarket, request: StorageRequest) {.async.} =
|
method requestStorage*(market: MockMarket, request: StorageRequest) {.async.} =
|
||||||
market.requests.add(request)
|
market.requested.add(request)
|
||||||
|
|
|
@ -23,7 +23,7 @@ suite "Purchasing":
|
||||||
|
|
||||||
test "submits a storage request when asked":
|
test "submits a storage request when asked":
|
||||||
await purchasing.purchase(request).wait()
|
await purchasing.purchase(request).wait()
|
||||||
let submitted = market.requests[0]
|
let submitted = market.requested[0]
|
||||||
check submitted.duration == request.duration
|
check submitted.duration == request.duration
|
||||||
check submitted.size == request.size
|
check submitted.size == request.size
|
||||||
check submitted.contentHash == request.contentHash
|
check submitted.contentHash == request.contentHash
|
||||||
|
@ -35,12 +35,12 @@ suite "Purchasing":
|
||||||
test "can change default value for proof probability":
|
test "can change default value for proof probability":
|
||||||
purchasing.proofProbability = 42.u256
|
purchasing.proofProbability = 42.u256
|
||||||
await purchasing.purchase(request).wait()
|
await purchasing.purchase(request).wait()
|
||||||
check market.requests[0].proofProbability == 42.u256
|
check market.requested[0].proofProbability == 42.u256
|
||||||
|
|
||||||
test "can override proof probability per request":
|
test "can override proof probability per request":
|
||||||
request.proofProbability = 42.u256
|
request.proofProbability = 42.u256
|
||||||
await purchasing.purchase(request).wait()
|
await purchasing.purchase(request).wait()
|
||||||
check market.requests[0].proofProbability == 42.u256
|
check market.requested[0].proofProbability == 42.u256
|
||||||
|
|
||||||
test "has a default value for request expiration interval":
|
test "has a default value for request expiration interval":
|
||||||
check purchasing.requestExpiryInterval != 0.u256
|
check purchasing.requestExpiryInterval != 0.u256
|
||||||
|
@ -49,15 +49,15 @@ suite "Purchasing":
|
||||||
purchasing.requestExpiryInterval = 42.u256
|
purchasing.requestExpiryInterval = 42.u256
|
||||||
let start = getTime().toUnix()
|
let start = getTime().toUnix()
|
||||||
await purchasing.purchase(request).wait()
|
await purchasing.purchase(request).wait()
|
||||||
check market.requests[0].expiry == (start + 42).u256
|
check market.requested[0].expiry == (start + 42).u256
|
||||||
|
|
||||||
test "can override expiry time per request":
|
test "can override expiry time per request":
|
||||||
let expiry = (getTime().toUnix() + 42).u256
|
let expiry = (getTime().toUnix() + 42).u256
|
||||||
request.expiry = expiry
|
request.expiry = expiry
|
||||||
await purchasing.purchase(request).wait()
|
await purchasing.purchase(request).wait()
|
||||||
check market.requests[0].expiry == expiry
|
check market.requested[0].expiry == expiry
|
||||||
|
|
||||||
test "includes a random nonce in every storage request":
|
test "includes a random nonce in every storage request":
|
||||||
await purchasing.purchase(request).wait()
|
await purchasing.purchase(request).wait()
|
||||||
await purchasing.purchase(request).wait()
|
await purchasing.purchase(request).wait()
|
||||||
check market.requests[0].nonce != market.requests[1].nonce
|
check market.requested[0].nonce != market.requested[1].nonce
|
||||||
|
|
Loading…
Reference in New Issue