Skip to content

Commit

Permalink
Add async transaction test
Browse files Browse the repository at this point in the history
  • Loading branch information
hfhbd committed Jul 16, 2023
1 parent 2b25be5 commit 96cf33c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ insertDog:
INSERT INTO dog
VALUES (?, ?, DEFAULT, ?);

insertDogAndReturnAll {
INSERT INTO dog
VALUES (?, ?, DEFAULT, ?);

SELECT * FROM dog;
}

selectDogs:
SELECT *
FROM dog;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,20 @@ class MySqlTest {
)
}

@Test
fun insertAndReturn() = runTest { database ->
val all = database.dogQueries.insertDogAndReturnAll("Tilda", "Pomeranian", null)
assertThat(all.awaitAsList())
.containsExactly(
Dog(
name = "Tilda",
breed = "Pomeranian",
is_good = true,
age = null,
),
)
}

@Test
fun simpleSelectWithIn() = runTest { database ->
with(database) {
Expand Down

0 comments on commit 96cf33c

Please sign in to comment.