I'd like to write better unit tests for Slick queries by testing that the correct values are bound in the right place.
Here's a simplified example of the type of method I'd like to test:
def insertExample(
key: String, name: String,
): FixedSqlAction[MyTableRow, NoStream, Effect.Write] = {
(table returning table) += Tables.MyTableRow(key = key, name = name)
}
And the unit test:
"insertExample" should "return expected SQL" in {
val context = mkContext
val action = context.testClass.insertExample("some-key", "some name")
val expectedSql = """insert into "my_table" ("key","name") values (?,?)"""
action.statements.size mustBe 1
action.statements.head mustEqual expectedSql
}
I've been unable to find a way to see what the bound values are, all I can see is the sql with ? placeholders.
How can I check which values are bound to make assertions in the unit test?