Skip to content
Snippets Groups Projects
Commit 35f8ef3a authored by npedot's avatar npedot
Browse files

adds test mapping with where condition

parent b4deda10
No related branches found
No related tags found
No related merge requests found
......@@ -115,6 +115,27 @@ class MappingTest {
assertEquals("t2.ssn2", query.select.from.joins?.get(0)?.joinOnRight)
}
@Test
fun test_mapping_with_where() {
// given
val sqlQuery = """
select SSN,DepName,DepAddress
from table0
where DepName is not null and DepAddress is not null
""".trimIndent()
// when
val mapping = UnSQLizeSelectUseCase().fromsql("query1", sqlQuery)
val actualSQL = SQLizeCreateUseCase().createViewCommand(mapping)
// then
assertEquals("DepName is not null and DepAddress is not null", mapping.select.where.condition)
assertEquals("""
CREATE OR REPLACE VIEW public.query1 AS
SELECT SSN,DepName,DepAddress
FROM table0
WHERE DepName is not null and DepAddress is not null LIMIT 10
""".trimIndent(),actualSQL)
}
@Test
fun test_multi_join() {
// given
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment