mirror of
https://github.com/Start9Labs/registry.git
synced 2026-03-26 02:11:53 +00:00
organization refactor separating database actions, data transformations, and api type constructs into separate components
This commit is contained in:
committed by
Keagan McClelland
parent
fe5218925d
commit
649f876692
@@ -3,21 +3,19 @@
|
||||
|
||||
module Handler.AppSpec
|
||||
( spec
|
||||
)
|
||||
where
|
||||
) where
|
||||
|
||||
import Startlude
|
||||
import Database.Persist.Sql
|
||||
import Data.Maybe
|
||||
import Database.Persist.Sql
|
||||
import Startlude
|
||||
|
||||
import TestImport
|
||||
import Model
|
||||
import Handler.Marketplace
|
||||
import Seed
|
||||
import Lib.Types.AppIndex
|
||||
import Data.Aeson
|
||||
import Data.Either.Extra
|
||||
import Handler.Marketplace ( PackageRes )
|
||||
import Handler.Types.Marketplace ( PackageRes(packageResDependencies, packageResManifest) )
|
||||
import Lib.Types.AppIndex
|
||||
import Model
|
||||
import Seed
|
||||
import TestImport
|
||||
|
||||
spec :: Spec
|
||||
spec = do
|
||||
@@ -92,13 +90,13 @@ spec = do
|
||||
setMethod "GET"
|
||||
setUrl ("/package/bitcoind.s9pk?spec==0.20.0" :: Text)
|
||||
statusIs 404
|
||||
xdescribe "GET /package/:pkgId with unknown package" $ withApp $ it "fails to get an unregistered app" $ do
|
||||
describe "GET /package/:pkgId with unknown package" $ withApp $ it "fails to get an unregistered app" $ do
|
||||
_ <- seedBitcoinLndStack
|
||||
request $ do
|
||||
setMethod "GET"
|
||||
setUrl ("/package/tempapp.s9pk?spec=0.0.1" :: Text)
|
||||
statusIs 404
|
||||
xdescribe "GET /package/:pkgId with package at unknown version"
|
||||
describe "GET /package/:pkgId with package at unknown version"
|
||||
$ withApp
|
||||
$ it "fails to get an unregistered app"
|
||||
$ do
|
||||
|
||||
38
test/Seed.hs
38
test/Seed.hs
@@ -1,25 +1,27 @@
|
||||
module Seed where
|
||||
|
||||
import Startlude ( ($)
|
||||
, Applicative(pure)
|
||||
, Maybe(Nothing, Just)
|
||||
, getCurrentTime
|
||||
, MonadIO(liftIO)
|
||||
)
|
||||
import Database.Persist.Sql ( PersistStoreWrite(insert_, insertKey, insert) )
|
||||
import Model ( Key(PkgRecordKey)
|
||||
, PkgRecord(PkgRecord)
|
||||
, Category(Category)
|
||||
import Database.Persist.Sql ( PersistStoreWrite(insert, insertKey, insert_) )
|
||||
import Model ( Category(Category)
|
||||
, Key(PkgRecordKey)
|
||||
, PkgCategory(PkgCategory)
|
||||
, PkgDependency(PkgDependency)
|
||||
, PkgRecord(PkgRecord)
|
||||
, VersionRecord(VersionRecord)
|
||||
)
|
||||
import Startlude ( ($)
|
||||
, Applicative(pure)
|
||||
, Maybe(Just, Nothing)
|
||||
, MonadIO(liftIO)
|
||||
, getCurrentTime
|
||||
)
|
||||
|
||||
import TestImport ( runDBtest
|
||||
, RegistryCtx
|
||||
import Lib.Types.Category ( CategoryTitle(BITCOIN, FEATURED, LIGHTNING) )
|
||||
import Prelude ( read )
|
||||
import TestImport ( RegistryCtx
|
||||
, SIO
|
||||
, YesodExampleData
|
||||
, runDBtest
|
||||
)
|
||||
import Lib.Types.Category ( CategoryTitle(LIGHTNING, FEATURED, BITCOIN) )
|
||||
|
||||
seedBitcoinLndStack :: SIO (YesodExampleData RegistryCtx) ()
|
||||
seedBitcoinLndStack = do
|
||||
@@ -73,4 +75,14 @@ seedBitcoinLndStack = do
|
||||
_ <- runDBtest $ insert_ $ PkgCategory time (PkgRecordKey "lnd") btcCat
|
||||
_ <- runDBtest $ insert_ $ PkgCategory time (PkgRecordKey "bitcoind") btcCat
|
||||
_ <- runDBtest $ insert_ $ PkgCategory time (PkgRecordKey "btc-rpc-proxy") btcCat
|
||||
_ <- runDBtest $ insert_ $ PkgDependency time
|
||||
(PkgRecordKey "lnd")
|
||||
"0.13.3.1"
|
||||
(PkgRecordKey "bitcoind")
|
||||
(read ">=0.21.1.2 <0.22.0")
|
||||
_ <- runDBtest $ insert_ $ PkgDependency time
|
||||
(PkgRecordKey "lnd")
|
||||
"0.13.3.1"
|
||||
(PkgRecordKey "btc-rpc-proxy")
|
||||
(read ">=0.3.2.1 <0.4.0")
|
||||
pure ()
|
||||
|
||||
Reference in New Issue
Block a user