From 1115b482335cd60affcc3aaf179f915989a9b983 Mon Sep 17 00:00:00 2001 From: Philip Carneiro Date: Thu, 8 Feb 2024 10:15:06 +0000 Subject: [PATCH] add more tests --- test/suite/commands.test.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/suite/commands.test.ts b/test/suite/commands.test.ts index 4e5f3570..6f198860 100644 --- a/test/suite/commands.test.ts +++ b/test/suite/commands.test.ts @@ -1665,6 +1665,30 @@ describe("serverCommand", () => { sinon.assert.notCalled(writeResultsViewStub); }); }); + + describe("getConextForRerunQuery", function () { + it("should return correct context for given input", function () { + assert.equal(serverCommand.getConextForRerunQuery("\\d .foo"), ".foo"); + assert.equal( + serverCommand.getConextForRerunQuery('system "d .bar'), + ".bar", + ); + }); + + it("should return default context for input without context", function () { + assert.equal( + serverCommand.getConextForRerunQuery("no context here"), + ".", + ); + }); + + it("should return last context for input with multiple contexts", function () { + assert.equal( + serverCommand.getConextForRerunQuery("\\d .foo\n\\d .bar"), + ".foo", + ); + }); + }); }); describe("walkthroughCommand", () => {