From 31120e8d8151a18902e4bc353ac19c838ea264d9 Mon Sep 17 00:00:00 2001 From: Philip Carneiro Date: Fri, 16 Aug 2024 11:17:36 +0100 Subject: [PATCH] add tests --- test/suite/utils.test.ts | 21 +++++++++++++++++++++ test/suite/webview.test.ts | 11 +++++++++++ 2 files changed, 32 insertions(+) diff --git a/test/suite/utils.test.ts b/test/suite/utils.test.ts index d7dcc39f..5e55684a 100644 --- a/test/suite/utils.test.ts +++ b/test/suite/utils.test.ts @@ -1813,4 +1813,25 @@ describe("Utils", () => { assert.strictEqual(result, true); }); }); + + describe("isLabelContentChanged", () => { + beforeEach(() => { + ext.latestLblsChanged.length = 0; + }); + + afterEach(() => { + ext.latestLblsChanged.length = 0; + }); + + it("should return true if label content is changed", () => { + ext.latestLblsChanged.push("label1"); + const result = LabelsUtils.isLabelContentChanged("label1"); + assert.strictEqual(result, true); + }); + + it("should return false if label content is not changed", () => { + const result = LabelsUtils.isLabelContentChanged("label1"); + assert.strictEqual(result, false); + }); + }); }); diff --git a/test/suite/webview.test.ts b/test/suite/webview.test.ts index d5fd1bc8..e239b6dd 100644 --- a/test/suite/webview.test.ts +++ b/test/suite/webview.test.ts @@ -585,6 +585,17 @@ describe("KdbNewConnectionView", () => { }); }); + describe("renderCreateConnectionBtn", () => { + it("should render create connection button", () => { + const result = view.renderCreateConnectionBtn(); + + assert.strictEqual( + JSON.stringify(result).includes("Create Connection"), + true, + ); + }); + }); + describe("renderEditConnectionForm", () => { it('should return "No connection found to be edited" when connectionData is null', () => { view.connectionData = null;