Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip-Carneiro-KX committed Aug 16, 2024
1 parent a9f9514 commit 31120e8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/suite/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
});
11 changes: 11 additions & 0 deletions test/suite/webview.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 31120e8

Please sign in to comment.