From b538125d1faf0af2ecf67e6600e825ba29eb9a18 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 18 Dec 2024 10:40:12 +0100 Subject: [PATCH] Add failing test --- .../src/api/routes/tests/viewV2.spec.ts | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/packages/server/src/api/routes/tests/viewV2.spec.ts b/packages/server/src/api/routes/tests/viewV2.spec.ts index 244a0a23eb..632dbfec3a 100644 --- a/packages/server/src/api/routes/tests/viewV2.spec.ts +++ b/packages/server/src/api/routes/tests/viewV2.spec.ts @@ -55,7 +55,7 @@ if (descriptions.length) { let datasource: Datasource | undefined function saveTableRequest( - ...overrides: Partial>[] + ...overrides: Partial[] ): SaveTableRequest { const req: SaveTableRequest = { name: generator.guid().replaceAll("-", "").substring(0, 16), @@ -1898,6 +1898,36 @@ if (descriptions.length) { } expect(view.queryUI).toEqual(expected) }) + + it("tables and views can contain whitespaces", async () => { + const table = await config.api.table.save( + saveTableRequest({ + name: "table with spaces", + schema: { + name: { + type: FieldType.STRING, + name: "name", + }, + }, + }) + ) + + const view = await config.api.viewV2.create({ + tableId: table._id!, + name: `view name with spaces`, + schema: { + name: { visible: true }, + }, + }) + + expect(await getDelegate(view)).toEqual({ + ...view, + schema: { + id: { ...table.schema["id"], visible: false }, + name: { ...table.schema["name"], visible: true }, + }, + }) + }) }) describe("updating table schema", () => {