From 81a1ab1e82ae170034545a25aa540a3a7c69acd7 Mon Sep 17 00:00:00 2001 From: fergusean Date: Fri, 21 Jun 2024 19:01:08 -0400 Subject: [PATCH] fix(sql): repair & enable @deepkit/sql tests (#579) --- .github/workflows/main.yml | 1 + packages/sql/tests/sql-query.spec.ts | 17 ++++++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 63c1b9d02..667640fb7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -73,6 +73,7 @@ jobs: packages/injector/ \ packages/logger/ \ packages/template/ \ + packages/sql/ \ packages/stopwatch/ \ packages/workflow/ \ packages/type/ diff --git a/packages/sql/tests/sql-query.spec.ts b/packages/sql/tests/sql-query.spec.ts index ece7fa4ba..4918c35d2 100644 --- a/packages/sql/tests/sql-query.spec.ts +++ b/packages/sql/tests/sql-query.spec.ts @@ -93,22 +93,21 @@ test('skip property', () => { test('QueryToSql', () => { class User { - id!: number; + id!: number & PrimaryKey; username!: string; password!: string; disabled!: boolean; created!: Date; } - const queryToSql = new SQLFilterBuilder(ReflectionClass.from(User), quoteId('user'), serializer, new SqlPlaceholderStrategy(), new class extends DefaultPlatform { - schemaParserType = MySchemaParser; - quoteIdentifier(id: string): string { - return quoteId(id); + const localAdapter: PreparedAdapter = { + ...adapter, + platform: new class extends MyPlatform { + quoteIdentifier = quoteId; } - quoteValue(value: any): string { - return escape(value); - } - }); + }; + + const queryToSql = new SQLFilterBuilder(localAdapter, ReflectionClass.from(User), quoteId('user'), serializer, new SqlPlaceholderStrategy()); expect(queryToSql.convert({ id: 123 })).toBe(`user.id = ?`); expect(queryToSql.convert({ id: '$id' })).toBe(`user.id = user.id`);