wasp/waspc/test/Parser/DbTest.hs
Martin Šošić f9e8f88b66
Upgraded to Prisma 2.21 (stable migrations) + postgre can be used in local dev.
- `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.
2021-04-21 14:06:25 +02:00

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