mirror of
https://github.com/status-im/nim-dagger.git
synced 2025-03-01 14:50:41 +00:00
* perf: contract storage optimizations * Apply optimization changes * Apply optimizing parameters sizing * Update codex-contracts-eth * bump latest changes in contracts branch * Change requestDurationLimit to uint64 * fix tests * fix tests --------- Co-authored-by: Arnaud <arnaud@status.im> Co-authored-by: Eric <5089238+emizzle@users.noreply.github.com>
30 lines
876 B
Nim
30 lines
876 B
Nim
import std/unittest
|
|
import pkg/questionable
|
|
import pkg/codex/contracts/requests
|
|
import pkg/codex/sales/states/cancelled
|
|
import pkg/codex/sales/states/downloading
|
|
import pkg/codex/sales/states/failed
|
|
import pkg/codex/sales/states/filled
|
|
import ../../examples
|
|
import ../../helpers
|
|
|
|
checksuite "sales state 'downloading'":
|
|
let request = StorageRequest.example
|
|
let slotIndex = request.ask.slots div 2
|
|
var state: SaleDownloading
|
|
|
|
setup:
|
|
state = SaleDownloading.new()
|
|
|
|
test "switches to cancelled state when request expires":
|
|
let next = state.onCancelled(request)
|
|
check !next of SaleCancelled
|
|
|
|
test "switches to failed state when request fails":
|
|
let next = state.onFailed(request)
|
|
check !next of SaleFailed
|
|
|
|
test "switches to filled state when slot is filled":
|
|
let next = state.onSlotFilled(request.id, slotIndex)
|
|
check !next of SaleFilled
|