|
3 | 3 |
|
4 | 4 | import * as sinon from 'sinon'; |
5 | 5 | 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'; |
7 | 18 | import * as workspaceApis from '../../../client/common/vscodeApis/workspaceApis'; |
8 | 19 | import { registerPythonStartup } from '../../../client/terminals/pythonStartup'; |
9 | 20 | import { IExtensionContext } from '../../../client/common/types'; |
10 | 21 | import * as pythonStartupLinkProvider from '../../../client/terminals/pythonStartupLinkProvider'; |
| 22 | +import { CustomTerminalLinkProvider } from '../../../client/terminals/pythonStartupLinkProvider'; |
11 | 23 |
|
12 | 24 | suite('Terminal - Shell Integration with PYTHONSTARTUP', () => { |
13 | 25 | let getConfigurationStub: sinon.SinonStub; |
@@ -136,4 +148,21 @@ suite('Terminal - Shell Integration with PYTHONSTARTUP', () => { |
136 | 148 |
|
137 | 149 | registerTerminalLinkProviderStub.restore(); |
138 | 150 | }); |
| 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 | + }); |
139 | 168 | }); |
0 commit comments