Fix queryUtils tests.

This commit is contained in:
Sam Rose 2025-02-25 09:19:25 +00:00
parent 477e61ee21
commit e6fc3dbff4
No known key found for this signature in database
1 changed files with 30 additions and 1 deletions

View File

@ -250,6 +250,8 @@ describe("query utils", () => {
expect(result).toEqual([ expect(result).toEqual([
"_id", "_id",
"name", "name",
"aux._id",
"auxTable._id",
"aux.title", "aux.title",
"auxTable.title", "auxTable.title",
"aux.name", "aux.name",
@ -284,7 +286,14 @@ describe("query utils", () => {
const result = await config.doInContext(config.appId, () => { const result = await config.doInContext(config.appId, () => {
return getQueryableFields(table) return getQueryableFields(table)
}) })
expect(result).toEqual(["_id", "name", "aux.name", "auxTable.name"]) expect(result).toEqual([
"_id",
"name",
"aux._id",
"auxTable._id",
"aux.name",
"auxTable.name",
])
}) })
it("excludes all relationship fields if hidden", async () => { it("excludes all relationship fields if hidden", async () => {
@ -387,10 +396,14 @@ describe("query utils", () => {
"_id", "_id",
"name", "name",
// aux1 primitive props // aux1 primitive props
"aux1._id",
"aux1Table._id",
"aux1.name", "aux1.name",
"aux1Table.name", "aux1Table.name",
// aux2 primitive props // aux2 primitive props
"aux2._id",
"aux2Table._id",
"aux2.title", "aux2.title",
"aux2Table.title", "aux2Table.title",
]) ])
@ -405,14 +418,20 @@ describe("query utils", () => {
"name", "name",
// aux2_1 primitive props // aux2_1 primitive props
"aux2_1._id",
"aux2Table._id",
"aux2_1.title", "aux2_1.title",
"aux2Table.title", "aux2Table.title",
// aux2_2 primitive props // aux2_2 primitive props
"aux2_2._id",
"aux2Table._id",
"aux2_2.title", "aux2_2.title",
"aux2Table.title", "aux2Table.title",
// table primitive props // table primitive props
"table._id",
"TestTable._id",
"table.name", "table.name",
"TestTable.name", "TestTable.name",
]) ])
@ -427,14 +446,20 @@ describe("query utils", () => {
"title", "title",
// aux1_1 primitive props // aux1_1 primitive props
"aux1_1._id",
"aux1Table._id",
"aux1_1.name", "aux1_1.name",
"aux1Table.name", "aux1Table.name",
// aux1_2 primitive props // aux1_2 primitive props
"aux1_2._id",
"aux1Table._id",
"aux1_2.name", "aux1_2.name",
"aux1Table.name", "aux1Table.name",
// table primitive props // table primitive props
"table._id",
"TestTable._id",
"table.name", "table.name",
"TestTable.name", "TestTable.name",
]) ])
@ -481,6 +506,8 @@ describe("query utils", () => {
"name", "name",
// deep 1 aux primitive props // deep 1 aux primitive props
"aux._id",
"auxTable._id",
"aux.title", "aux.title",
"auxTable.title", "auxTable.title",
]) ])
@ -495,6 +522,8 @@ describe("query utils", () => {
"title", "title",
// deep 1 dependency primitive props // deep 1 dependency primitive props
"table._id",
"TestTable._id",
"table.name", "table.name",
"TestTable.name", "TestTable.name",
]) ])