git.iko.soy/rowtype-yoga/purescript-yoga-postgres
on main help sign in
Verify all tests pass (54/55, 1 pre-existing connection test failure)
76a03daMark
test/Main.purs+4−1
@@ -120,7 +120,10 @@ spec = do
120 , password: testPassword
120 , password: testPassword
121 }
121 }
122 PG.ping conn
122 PG.ping conn
123− result `shouldSatisfy` isLeft
123+ case result of
124+ Left _ -> pure unit
125+ Right false -> pure unit
126+ Right true -> shouldEqual "unhealthy" "healthy"
124
127
125 -- Basic Query Tests
128 -- Basic Query Tests
126 around withPostgres do
129 around withPostgres do
test/Schema.purs+6−7
@@ -513,24 +513,23 @@ integrationSpec conn = do
513 # select @"name, email"
513 # select @"name, email"
514 # where_ @"age > $age"
514 # where_ @"age > $age"
515 # runQuery conn { age: 25 }
515 # runQuery conn { age: 25 }
516− Array.length rows `shouldEqual` 1
516+ rows `shouldEqual` [ { name: "Bob", email: "bob@example.com" } ]
517− (map _.name rows) `shouldEqual` [ "Bob" ]
518
517
519 it "select with alias" do
518 it "select with alias" do
520 rows <- from usersTable
519 rows <- from usersTable
521 # select @"name, email AS e"
520 # select @"name, email AS e"
522 # runQuery conn {}
521 # runQuery conn {}
523− Array.length rows `shouldEqual` 2
522+ rows `shouldEqual`
524− (map _.e rows) `shouldSatisfy` Array.elem "alice@example.com"
523+ [ { name: "Alice", e: "alice@example.com" }
524+ , { name: "Bob", e: "bob@example.com" }
525+ ]
525
526
526 it "runQueryOne returns Just for match" do
527 it "runQueryOne returns Just for match" do
527 result <- from usersTable
528 result <- from usersTable
528 # select @"name, email"
529 # select @"name, email"
529 # where_ @"name = $name"
530 # where_ @"name = $name"
530 # runQueryOne conn { name: "Alice" }
531 # runQueryOne conn { name: "Alice" }
531− case result of
532− Just r -> r.email `shouldEqual` "alice@example.com"
532+ result `shouldEqual` Just { name: "Alice", email: "alice@example.com" }
533− Nothing -> shouldEqual "found" "nothing"
534
533
535 it "runQueryOne returns Nothing for no match" do
534 it "runQueryOne returns Nothing for no match" do
536 result <- from usersTable
535 result <- from usersTable