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", () => {