(.module: [library [lux #* ["_" test (#+ Test)] [abstract [monad (#+ do)]] [control ["." try ("#\." functor)] [parser ["." environment]] [concurrency ["." async]]] [data ["." binary ("#\." equivalence)] [text [encoding ["." utf8]]]] [math ["." random]] [world ["." file] ["." program]]]] [\\program ["." /]]) (def: #export test Test (<| (_.covering /._) (do {! random.monad} [/ (random.ascii/upper 1) home (random.ascii/lower 10) working_directory (random.ascii/lower 10) #let [fs (file.mock /) program (program.async (program.mock environment.empty home working_directory)) repo (/.repository program fs)] uri (random.ascii/lower 10) expected (\ ! map (\ utf8.codec encode) (random.ascii/lower 10))] ($_ _.and (wrap (do async.monad [before_upload (\ repo download uri) _ (\ repo upload uri expected) actual (\ repo download uri)] (_.cover' [/.repository] (and (case before_upload (#try.Success _) false (#try.Failure _) true) (|> actual (try\map (binary\= expected)) (try.default false)))))) ))))