test(query): cover editable Oracle subqueries

This commit is contained in:
t8y2 committed 2026-07-14 01:21:17 +08:00
1 parent e74af3e85f
commit 65e1100db8
3 files changed
+85

No files matched your search

@@ -64,6 +64,18 @@ describe("editable query hidden primary keys", () => {
});
});
it("preserves a WHERE subquery when adding an Oracle ROWID", () => {
expect(
buildQueryWithHiddenPrimaryKeys({
sql: "SELECT t.* FROM APP.PLATFORM_CARS t WHERE t.CUSTOMER_NO IN (SELECT c.CUSTOMER_NO FROM APP.CUSTOMERS c WHERE c.ENABLED = 1)",
databaseType: "oracle",
primaryKeys: ["__DBX_ROWID"],
existingResultNames: ["ID", "CUSTOMER_NO"],
sourceExpressions: { __DBX_ROWID: "ROWIDTOCHAR(ROWID)" },
})?.sql,
).toBe('SELECT t.*, ROWIDTOCHAR(ROWID) AS "__DBX_PK_0" FROM APP.PLATFORM_CARS t WHERE t.CUSTOMER_NO IN (SELECT c.CUSTOMER_NO FROM APP.CUSTOMERS c WHERE c.ENABLED = 1)');
});
it("inserts hidden keys before a trailing line comment", () => {
expect(
buildQueryWithHiddenPrimaryKeys({