(.module: [lux #* ["_" test (#+ Test)] [abstract [monad (#+ do)]] [control ["." try (#+ Try)] [concurrency ["." promise (#+ Promise)]]] [data ["." binary {[0 #test] ["_#" /]}]] [math ["." random]]] {#program ["." / ["#." remote] ["/#" // #_ ["#." artifact (#+ Artifact) ["#/." extension]]]]} {#test ["_." // #_ ["#." artifact]]}) (def: #export (spec valid_artifact invalid_artifact subject) (-> Artifact Artifact (/.Repository Promise) Test) (do random.monad [expected (_binary.random 100)] (wrap ($_ _.and' (do promise.monad [#let [uri/good (/remote.uri valid_artifact //artifact/extension.lux_library)] upload!/good (\ subject upload uri/good expected) download!/good (\ subject download uri/good) #let [uri/bad (/remote.uri invalid_artifact //artifact/extension.lux_library)] upload!/bad (\ subject upload uri/bad expected) download!/bad (\ subject download uri/bad)] (_.cover' [/.Repository] (and (case [upload!/good download!/good] [(#try.Success _) (#try.Success actual)] (\ binary.equivalence = expected actual) _ false) (case [upload!/bad download!/bad] [(#try.Failure _) (#try.Failure _)] true _ false)))) ))))