Skip to content

Commit 8e7244b

Browse files
committed
add more test
1 parent 9af9d51 commit 8e7244b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/test/common/terminals/service.unit.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,25 @@ suite('Terminal Service', () => {
190190
});
191191

192192
// Ensure sendText is called when Python shell integration is disabled.
193+
test('Ensure text is sent to terminal and it is shown when Python shell integration is disabled', async () => {
194+
pythonConfig
195+
.setup((p) => p.get('terminal.shellIntegration.enabled'))
196+
.returns(() => false)
197+
.verifiable(TypeMoq.Times.once());
198+
199+
terminalHelper
200+
.setup((helper) => helper.getEnvironmentActivationCommands(TypeMoq.It.isAny(), TypeMoq.It.isAny()))
201+
.returns(() => Promise.resolve(undefined));
202+
service = new TerminalService(mockServiceContainer.object);
203+
const textToSend = 'Some Text';
204+
terminalHelper.setup((h) => h.identifyTerminalShell(TypeMoq.It.isAny())).returns(() => TerminalShellType.bash);
205+
terminalManager.setup((t) => t.createTerminal(TypeMoq.It.isAny())).returns(() => terminal.object);
206+
207+
await service.sendText(textToSend);
208+
209+
terminal.verify((t) => t.show(TypeMoq.It.isValue(true)), TypeMoq.Times.exactly(2));
210+
terminal.verify((t) => t.sendText(TypeMoq.It.isValue(textToSend)), TypeMoq.Times.exactly(1));
211+
});
193212

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

0 commit comments

Comments
 (0)