-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests for doobie/zio, bugfix for zio upsert, don't use streaming unsa…
…ved in test as it doesnt work for pg 12
- Loading branch information
1 parent
1292062
commit 694f33e
Showing
7 changed files
with
55 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
typo-tester-doobie/src/scala/adventureworks/IdentityTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package adventureworks | ||
|
||
import adventureworks.customtypes.* | ||
import adventureworks.public.identity_test.* | ||
import doobie.free.connection.delay | ||
import org.scalactic.TypeCheckedTripleEquals | ||
import org.scalatest.funsuite.AnyFunSuite | ||
|
||
class IdentityTest extends AnyFunSuite with TypeCheckedTripleEquals { | ||
val repo = new IdentityTestRepoImpl() | ||
|
||
test("works") { | ||
withConnection { | ||
val unsaved = IdentityTestRowUnsaved(IdentityTestId("a"), Defaulted.UseDefault) | ||
for { | ||
inserted <- repo.insert(unsaved) | ||
upserted <- repo.upsert(inserted) | ||
_ <- delay(assert(inserted === upserted)) | ||
rows <- repo.select.orderBy(_.name.asc).toList | ||
_ <- delay(rows === List(IdentityTestRow(1, 1, IdentityTestId("a")))) | ||
} yield () | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
typo-tester-zio-jdbc/src/scala/adventureworks/IdentityTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package adventureworks | ||
|
||
import adventureworks.customtypes.* | ||
import adventureworks.public.identity_test.* | ||
import org.scalactic.TypeCheckedTripleEquals | ||
import org.scalatest.funsuite.AnyFunSuite | ||
import zio.{Chunk, ZIO} | ||
|
||
class IdentityTest extends AnyFunSuite with TypeCheckedTripleEquals { | ||
val repo = new IdentityTestRepoImpl() | ||
|
||
test("works") { | ||
withConnection { | ||
val unsaved = IdentityTestRowUnsaved(IdentityTestId("a"), Defaulted.UseDefault) | ||
for { | ||
inserted <- repo.insert(unsaved) | ||
upserted <- repo.upsert(inserted) | ||
_ <- ZIO.succeed(assert(inserted === upserted.updatedKeys.head)) | ||
rows <- repo.select.orderBy(_.name.asc).toChunk | ||
_ <- ZIO.succeed(rows === Chunk(IdentityTestRow(1, 1, IdentityTestId("a")))) | ||
} yield () | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters