Skip to content

Commit

Permalink
add more test
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonykim1 committed Nov 12, 2024
1 parent 9af9d51 commit 8e7244b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/test/common/terminals/service.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,25 @@ suite('Terminal Service', () => {
});

// Ensure sendText is called when Python shell integration is disabled.
test('Ensure text is sent to terminal and it is shown when Python shell integration is disabled', async () => {
pythonConfig
.setup((p) => p.get('terminal.shellIntegration.enabled'))
.returns(() => false)
.verifiable(TypeMoq.Times.once());

terminalHelper
.setup((helper) => helper.getEnvironmentActivationCommands(TypeMoq.It.isAny(), TypeMoq.It.isAny()))
.returns(() => Promise.resolve(undefined));
service = new TerminalService(mockServiceContainer.object);
const textToSend = 'Some Text';
terminalHelper.setup((h) => h.identifyTerminalShell(TypeMoq.It.isAny())).returns(() => TerminalShellType.bash);
terminalManager.setup((t) => t.createTerminal(TypeMoq.It.isAny())).returns(() => terminal.object);

await service.sendText(textToSend);

terminal.verify((t) => t.show(TypeMoq.It.isValue(true)), TypeMoq.Times.exactly(2));
terminal.verify((t) => t.sendText(TypeMoq.It.isValue(textToSend)), TypeMoq.Times.exactly(1));
});

// Ensure executeCommand is called when Python shell integration and terminal shell integration are both enabled

Expand Down

0 comments on commit 8e7244b

Please sign in to comment.