Skip to content

Commit 8c050a7

Browse files
committed
fix test
1 parent dc11862 commit 8c050a7

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

src/test/terminals/codeExecution/helper.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import { EnvironmentType, PythonEnvironment } from '../../../client/pythonEnviro
3434
import { CodeExecutionHelper } from '../../../client/terminals/codeExecution/helper';
3535
import { ICodeExecutionHelper } from '../../../client/terminals/types';
3636
import { PYTHON_PATH } from '../../common';
37+
import { ReplType } from '../../../client/repl/types';
3738

3839
const TEST_FILES_PATH = path.join(EXTENSION_ROOT_DIR, 'src', 'test', 'python_files', 'terminalExec');
3940

@@ -160,7 +161,7 @@ suite('Terminal - Code Execution Helper', () => {
160161
};
161162
jsonParseStub.returns(mockResult);
162163

163-
const result = await helper.normalizeLines('print("Looks like you are on 3.13")');
164+
const result = await helper.normalizeLines('print("Looks like you are on 3.13")', ReplType.terminal);
164165

165166
expect(result).to.equal(`\u001b[200~print("Looks like you are on 3.13")\u001b[201~`);
166167
jsonParseStub.restore();
@@ -190,7 +191,7 @@ suite('Terminal - Code Execution Helper', () => {
190191
actualProcessService.execObservable.apply(actualProcessService, [file, args, options]),
191192
);
192193

193-
const result = await helper.normalizeLines('print("Looks like you are not on 3.13")');
194+
const result = await helper.normalizeLines('print("Looks like you are not on 3.13")', ReplType.terminal);
194195

195196
expect(result).to.equal('print("Looks like you are not on 3.13")');
196197
jsonParseStub.restore();
@@ -207,7 +208,7 @@ suite('Terminal - Code Execution Helper', () => {
207208
return ({} as unknown) as ObservableExecutionResult<string>;
208209
});
209210

210-
await helper.normalizeLines('print("hello")');
211+
await helper.normalizeLines('print("hello")', ReplType.terminal);
211212

212213
expect(execArgs).to.contain('normalizeSelection.py');
213214
});
@@ -228,7 +229,7 @@ suite('Terminal - Code Execution Helper', () => {
228229
.returns((file, args, options) =>
229230
actualProcessService.execObservable.apply(actualProcessService, [file, args, options]),
230231
);
231-
const normalizedCode = await helper.normalizeLines(source);
232+
const normalizedCode = await helper.normalizeLines(source, ReplType.terminal);
232233
const normalizedExpected = expectedSource.replace(/\r\n/g, '\n');
233234
expect(normalizedCode).to.be.equal(normalizedExpected);
234235
}

src/test/terminals/codeExecution/smartSend.test.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { PYTHON_PATH } from '../../common';
2525
import { Architecture } from '../../../client/common/utils/platform';
2626
import { ProcessService } from '../../../client/common/process/proc';
2727
import { l10n } from '../../mocks/vsc';
28+
import { ReplType } from '../../../client/repl/types';
2829

2930
const TEST_FILES_PATH = path.join(EXTENSION_ROOT_DIR, 'src', 'test', 'python_files', 'terminalExec');
3031

@@ -145,7 +146,7 @@ suite('REPL - Smart Send', () => {
145146
.setup((p) => p.execObservable(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()))
146147
.returns((file, args, options) => execObservable.apply(actualProcessService, [file, args, options]));
147148

148-
await codeExecutionHelper.normalizeLines('my_dict = {', wholeFileContent);
149+
await codeExecutionHelper.normalizeLines('my_dict = {', ReplType.terminal, wholeFileContent);
149150

150151
commandManager
151152
.setup((c) => c.executeCommand('cursorMove', TypeMoq.It.isAny()))
@@ -197,7 +198,11 @@ suite('REPL - Smart Send', () => {
197198
.setup((p) => p.execObservable(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()))
198199
.returns((file, args, options) => execObservable.apply(actualProcessService, [file, args, options]));
199200

200-
const actualSmartOutput = await codeExecutionHelper.normalizeLines('my_dict = {', wholeFileContent);
201+
const actualSmartOutput = await codeExecutionHelper.normalizeLines(
202+
'my_dict = {',
203+
ReplType.terminal,
204+
wholeFileContent,
205+
);
201206

202207
// my_dict = { <----- smart shift+enter here
203208
// "key1": "value1",
@@ -247,7 +252,11 @@ suite('REPL - Smart Send', () => {
247252
.setup((p) => p.execObservable(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()))
248253
.returns((file, args, options) => execObservable.apply(actualProcessService, [file, args, options]));
249254

250-
const actualNonSmartResult = await codeExecutionHelper.normalizeLines('my_dict = {', wholeFileContent);
255+
const actualNonSmartResult = await codeExecutionHelper.normalizeLines(
256+
'my_dict = {',
257+
ReplType.terminal,
258+
wholeFileContent,
259+
);
251260
const expectedNonSmartResult = 'my_dict = {\n\n'; // Standard for previous normalization logic
252261
expect(actualNonSmartResult).to.be.equal(expectedNonSmartResult);
253262
});
@@ -285,7 +294,7 @@ suite('REPL - Smart Send', () => {
285294
.setup((p) => p.execObservable(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()))
286295
.returns((file, args, options) => execObservable.apply(actualProcessService, [file, args, options]));
287296

288-
await codeExecutionHelper.normalizeLines('my_dict = {', wholeFileContent);
297+
await codeExecutionHelper.normalizeLines('my_dict = {', ReplType.terminal, wholeFileContent);
289298

290299
applicationShell
291300
.setup((a) =>

0 commit comments

Comments
 (0)