Skip to content

Commit 73d8765

Browse files
increase test coverage
1 parent 3d9261a commit 73d8765

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

test/suite/commands.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,21 @@ describe("dataSourceCommand2", () => {
653653
ext.isResultsTabVisible = false;
654654
});
655655

656+
it("should not proceed there is no connection selected", async () => {
657+
ext.activeConnection = undefined;
658+
await dataSourceCommand.runDataSource(
659+
{} as DataSourceFiles,
660+
"",
661+
"test-file.kdb.json",
662+
);
663+
windowMock
664+
.expects("showInformationMessage")
665+
.once()
666+
.withArgs(
667+
"You didn't selected any existing connection to execute this action, please select a connection and try again.",
668+
);
669+
});
670+
656671
it("should show an error message if not connected to an Insights server", async () => {
657672
ext.activeConnection = undefined;
658673
getMetaStub.resolves({});

test/suite/utils.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,20 @@ describe("Utils", () => {
366366
assert.ok(stub.calledOnce);
367367
});
368368
});
369+
370+
describe("noSelectedConnectionAction", () => {
371+
afterEach(() => {
372+
sinon.restore();
373+
});
374+
375+
it("should call showInformationMessage", () => {
376+
const stub = sinon
377+
.stub(vscode.window, "showInformationMessage")
378+
.resolves();
379+
coreUtils.noSelectedConnectionAction();
380+
assert.ok(stub.calledOnce);
381+
});
382+
});
369383
});
370384

371385
describe("dataSource", () => {

0 commit comments

Comments
 (0)