Skip to content

Commit

Permalink
zio#154: Extend tests of renderUpdate for Oracle
Browse files Browse the repository at this point in the history
  • Loading branch information
baldram committed May 28, 2022
1 parent 646e8cd commit 4779296
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions oracle/src/test/scala/zio/sql/oracle/OracleSqlModuleSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,27 @@ object OracleSqlModuleSpec extends OracleRunnableSpec with ShopSchema {
import Customers._

override def specLayered: Spec[SqlDriver, Exception] = suite("Oracle module")(
test("Can update rows") {
test("Can update selected rows") {
/**
* UPDATE customers SET customers.first_name = 'Jaroslav'
* UPDATE customers SET customers.first_name = 'Antek'
* WHERE 1 = 1 and customers.verified = 0 and customers.verified <> 1
*/
val query =
update(customers)
.set(fName, "Jaroslav")
.set(fName, "Antek")
.where(verified isNotTrue)
.where(verified <> true) // we intentionally verify two syntax variants

assertZIO(execute(query))(equalTo(1))
},
test("Can update all rows") {
/**
* UPDATE customers SET customers.first_name = 'Antek' WHERE 1 = 1
*/
val query = update(customers).set(fName, "Antek")

assertZIO(execute(query))(equalTo(5))
},
test("Can delete from single table with a condition") {
/**
* DELETE FROM customers WHERE customers.verified = 0
Expand Down

0 comments on commit 4779296

Please sign in to comment.