Skip to content

Commit c648fda

Browse files
committed
add more test
1 parent ee8909f commit c648fda

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

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

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,23 @@
33

44
import * as sinon from 'sinon';
55
import * as TypeMoq from 'typemoq';
6-
import { GlobalEnvironmentVariableCollection, Uri, WorkspaceConfiguration, Disposable } from 'vscode';
6+
import {
7+
GlobalEnvironmentVariableCollection,
8+
Uri,
9+
WorkspaceConfiguration,
10+
Disposable,
11+
CancellationToken,
12+
TerminalLinkContext,
13+
Terminal,
14+
EventEmitter,
15+
TerminalLink,
16+
} from 'vscode';
17+
import { assert } from 'chai';
718
import * as workspaceApis from '../../../client/common/vscodeApis/workspaceApis';
819
import { registerPythonStartup } from '../../../client/terminals/pythonStartup';
920
import { IExtensionContext } from '../../../client/common/types';
1021
import * as pythonStartupLinkProvider from '../../../client/terminals/pythonStartupLinkProvider';
22+
import { CustomTerminalLinkProvider } from '../../../client/terminals/pythonStartupLinkProvider';
1123

1224
suite('Terminal - Shell Integration with PYTHONSTARTUP', () => {
1325
let getConfigurationStub: sinon.SinonStub;
@@ -136,4 +148,21 @@ suite('Terminal - Shell Integration with PYTHONSTARTUP', () => {
136148

137149
registerTerminalLinkProviderStub.restore();
138150
});
151+
152+
test('Verify provideTerminalLinks returns links when context.line contains expectedNativeLink', () => {
153+
const provider = new CustomTerminalLinkProvider();
154+
const context: TerminalLinkContext = {
155+
line: 'Some random string with VS Code Native REPL in it',
156+
terminal: {} as Terminal,
157+
};
158+
const token: CancellationToken = {
159+
isCancellationRequested: false,
160+
onCancellationRequested: new EventEmitter<unknown>().event,
161+
};
162+
163+
const links = provider.provideTerminalLinks(context, token);
164+
165+
assert.isNotNull(links, 'Expected links to be not undefined');
166+
assert.isArray(links, 'Expected links to be an array');
167+
});
139168
});

0 commit comments

Comments
 (0)