git.iko.soy/rowtype-yoga/purescript-yoga-postgres
on main help sign in
commit18fc598e7794a9f761cae7d8a26b9c7d1b6d9a63 authorMark <mark.eibes@gmail.com> dateFri 13 Feb 2026, 14:02 (8 months ago) parent3997c4a
2 files changed+21
test/Main.purs+3 test/Schema.purs+18
test/Main.purs+3
@@ -14,6 +14,7 @@ import Test.Spec.Assertions (shouldEqual, shouldSatisfy)
1414import Test.Spec.Reporter.Console (consoleReporter)
1515import Test.Spec.Runner (runSpec)
1616import Yoga.Test.Docker as Docker
17+import Test.Postgres.Schema as Schema
1718import Yoga.Postgres as PG
1819
1920-- Test configuration
@@ -91,6 +92,8 @@ setupTableWithConstraints conn = do
9192
9293spec :: Spec Unit
9394spec = do
95+ Schema.spec
96+
9497 describe "Yoga.Postgres Integration Tests" do
9598
9699 -- Connection Management Tests
test/Schema.purs+18
@@ -3,7 +3,10 @@ module Test.Postgres.Schema where
33import Prelude
44
55import Data.Maybe (Maybe)
6+import Data.String (contains, Pattern(..))
67import Data.Tuple.Nested (type (/\))
8+import Test.Spec (Spec, describe, it)
9+import Test.Spec.Assertions (shouldEqual, shouldSatisfy)
710import Yoga.Postgres.Schema
811
912-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -81,3 +84,18 @@ ddl = createTableDDL @UsersTable
8184
8285-- deleteResult :: PG.Connection -> Aff Int
8386-- deleteResult conn = delete @UsersTable { id: 1 } conn
87+
88+-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
89+-- Spec
90+-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
91+
92+spec :: Spec Unit
93+spec = do
94+ describe "Schema" do
95+ describe "CREATE TABLE DDL" do
96+ it "generates correct DDL for UsersTable" do
97+ ddl `shouldSatisfy` contains (Pattern "CREATE TABLE users")
98+ ddl `shouldSatisfy` contains (Pattern "id INTEGER NOT NULL PRIMARY KEY")
99+ ddl `shouldSatisfy` contains (Pattern "name TEXT NOT NULL")
100+ ddl `shouldSatisfy` contains (Pattern "email TEXT NOT NULL UNIQUE")
101+ ddl `shouldSatisfy` contains (Pattern "age INTEGER")