Add a test for a count distinct column that references a non-existent field.

This commit is contained in:
Sam Rose 2024-10-02 16:47:53 +01:00
parent 50c307df4d
commit 7ed28593fb
No known key found for this signature in database
1 changed files with 24 additions and 0 deletions

View File

@ -2796,6 +2796,30 @@ describe.each([
expect(rows).toHaveLength(1)
expect(rows[0].count).toEqual(2)
})
it("should not be able to COUNT(DISTINCT ...) against a non-existent field", async () => {
await config.api.viewV2.create(
{
tableId: table._id!,
name: generator.guid(),
schema: {
count: {
visible: true,
calculationType: CalculationType.COUNT,
distinct: true,
field: "does not exist oh no",
},
},
},
{
status: 400,
body: {
message:
'Calculation field "count" references field "does not exist oh no" which does not exist in the table schema',
},
}
)
})
})
!isLucene &&