import std/random import pkg/questionable import pkg/questionable/results import pkg/chronos import pkg/asynctest import pkg/datastore import pkg/codex/stores import pkg/codex/sales import pkg/codex/utils/json import ../examples import ../helpers asyncchecksuite "Reservations module": var repo: RepoStore repoDs: Datastore metaDs: SQLiteDatastore reservations: Reservations setup: randomize(1.int64) # create reproducible results repoDs = SQLiteDatastore.new(Memory).tryGet() metaDs = SQLiteDatastore.new(Memory).tryGet() repo = RepoStore.new(repoDs, metaDs) reservations = Reservations.new(repo) proc createAvailability(): Availability = let example = Availability.example let size = rand(100000..200000) let availability = waitFor reservations.createAvailability( size.u256, example.duration, example.minPrice, example.maxCollateral ) return availability.get proc createReservation(availability: Availability): Reservation = let size = rand(1..