Skip to content

Commit 04a1b3c

Browse files
committed
add test, context.subscriptions in test
1 parent ed1d678 commit 04a1b3c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/test/terminals/shellIntegration/pythonStartup.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
TerminalLinkContext,
1313
Terminal,
1414
EventEmitter,
15+
workspace,
1516
} from 'vscode';
1617
import { assert } from 'chai';
1718
import * as workspaceApis from '../../../client/common/vscodeApis/workspaceApis';
@@ -35,6 +36,7 @@ suite('Terminal - Shell Integration with PYTHONSTARTUP', () => {
3536
globalEnvironmentVariableCollection = TypeMoq.Mock.ofType<GlobalEnvironmentVariableCollection>();
3637
context.setup((c) => c.environmentVariableCollection).returns(() => globalEnvironmentVariableCollection.object);
3738
context.setup((c) => c.storageUri).returns(() => Uri.parse('a'));
39+
context.setup((c) => c.subscriptions).returns(() => []);
3840

3941
globalEnvironmentVariableCollection
4042
.setup((c) => c.replace(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()))
@@ -146,6 +148,17 @@ suite('Terminal - Shell Integration with PYTHONSTARTUP', () => {
146148

147149
registerTerminalLinkProviderStub.restore();
148150
});
151+
152+
test('Verify onDidChangeConfiguration is called when configuration changes', async () => {
153+
const onDidChangeConfigurationSpy = sinon.spy(workspace, 'onDidChangeConfiguration');
154+
pythonConfig.setup((p) => p.get('terminal.shellIntegration.enabled')).returns(() => true);
155+
156+
await registerPythonStartup(context.object);
157+
158+
assert.isTrue(onDidChangeConfigurationSpy.calledOnce);
159+
onDidChangeConfigurationSpy.restore();
160+
});
161+
149162
if (process.platform === 'darwin') {
150163
test('Mac - Verify provideTerminalLinks returns links when context.line contains expectedNativeLink', () => {
151164
const provider = new CustomTerminalLinkProvider();

0 commit comments

Comments
 (0)