From a3661f294b10fd1aa4402ac548e52bda50765bc7 Mon Sep 17 00:00:00 2001 From: Jakub Knejzlik Date: Thu, 8 Feb 2024 10:47:24 +0100 Subject: [PATCH] Fix cvas serialization --- src/CreateViewAsSelect.test.ts | 7 +++++-- src/interfaces.ts | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/CreateViewAsSelect.test.ts b/src/CreateViewAsSelect.test.ts index 58f55a3..800562c 100644 --- a/src/CreateViewAsSelect.test.ts +++ b/src/CreateViewAsSelect.test.ts @@ -31,13 +31,16 @@ describe("CreateViewAsSelect", () => { }); it("should serialize and deserialize correctly", () => { - const cvas = Q.createTableAs(viewName, initialSelectQuery); + const cvas = Q.createViewAs(viewName, initialSelectQuery); + const cvasReplace = Q.createOrReplaceViewAs(viewName, initialSelectQuery); const serialized = cvas.serialize(); const deserialized = Q.deserialize(serialized); - expect(deserialized.toSQL(new MySQLFlavor())).toEqual( cvas.toSQL(new MySQLFlavor()) ); + expect( + Q.deserialize(cvasReplace.serialize()).toSQL(new MySQLFlavor()) + ).toEqual(cvasReplace.toSQL(new MySQLFlavor())); }); it("should fetch table names correctly", () => { diff --git a/src/interfaces.ts b/src/interfaces.ts index 748eed5..2954025 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -13,7 +13,7 @@ export enum MetadataOperationType { UPDATE = "Update", DELETE = "Delete", CREATE_TABLE_AS = "CTAS", - CREATE_VIEW_AS = "CTAS", + CREATE_VIEW_AS = "CVAS", } export interface IMetadata {