From 0c51a60e9ab16765ca1c5def7d5b1584331124c7 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 28 Feb 2024 10:16:21 +0000 Subject: [PATCH] Updating test cases as per PR comments. --- .../src/integrations/tests/sqlAlias.spec.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/server/src/integrations/tests/sqlAlias.spec.ts b/packages/server/src/integrations/tests/sqlAlias.spec.ts index acf0f9898f..0672b421f2 100644 --- a/packages/server/src/integrations/tests/sqlAlias.spec.ts +++ b/packages/server/src/integrations/tests/sqlAlias.spec.ts @@ -176,11 +176,18 @@ describe("Captures of real examples", () => { }) describe("check some edge cases", () => { + const dotTableNames = ["hello.world", "foo.bar.baz"] + it("should handle table names/columns with dots in them", () => { - const tableNames = ["hello.world", "foo.bar.baz"] - const aliasing = new AliasTables(tableNames) - const aliased = aliasing.aliasField("hello.world.field") - expect(aliased).toEqual("a.field") + const aliasing = new AliasTables(dotTableNames) + const aliased = aliasing.aliasField(`"hello.world"."field"`) + expect(aliased).toEqual(`"a"."field"`) + }) + + it("should confirm table with dots in them works with grave accents", () => { + const aliasing = new AliasTables(dotTableNames) + const aliased = aliasing.aliasField("`hello.world`.`field`") + expect(aliased).toEqual("`a`.`field`") }) }) })