mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-12-26 10:35:04 +03:00
f9e8f88b66
- `wasp db migrate-save` and `wasp db migrate-up` got replaced with `wasp db migrate-dev`. - Wasp now has a declarative way to express which db is used, postgresql or sqlite: `db { system: PostgreSQL }`. - Prisma is now at the latest version, 2.21. PSL parser was upgraded to work with this. - PostgreSQL can now be used for local development. - We migrated examples/realworld to work with this new version of Wasp.
25 lines
826 B
Haskell
25 lines
826 B
Haskell
module Parser.DbTest where
|
|
|
|
import Test.Tasty.Hspec
|
|
|
|
import Data.Either (isLeft)
|
|
|
|
import Parser.Common (runWaspParser)
|
|
import Parser.Db (db)
|
|
import qualified Wasp.Db
|
|
|
|
|
|
spec_parseDb :: Spec
|
|
spec_parseDb =
|
|
describe "Parsing db declaration" $ do
|
|
let parseDb input = runWaspParser db input
|
|
|
|
it "When given a valid db declaration, returns correct AST" $ do
|
|
parseDb "db { system: PostgreSQL }"
|
|
`shouldBe` Right (Wasp.Db.Db { Wasp.Db._system = Wasp.Db.PostgreSQL })
|
|
parseDb "db { system: SQLite }"
|
|
`shouldBe` Right (Wasp.Db.Db { Wasp.Db._system = Wasp.Db.SQLite })
|
|
|
|
it "When given db wasp declaration without 'db', should return Left" $ do
|
|
isLeft (parseDb "db { }") `shouldBe` True
|