Skip to content

Commit 50963ab

Browse files
fix tests
1 parent 7d7217d commit 50963ab

File tree

7 files changed

+7
-45
lines changed

7 files changed

+7
-45
lines changed

src/extension/debugger/configuration/providers/remoteAttach.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ export async function buildRemoteAttachConfiguration(
4747
value && value.trim().length > 0 ? undefined : DebugConfigStrings.attach.enterRemoteHost.invalid,
4848
),
4949
});
50+
5051
if (!connect.host) {
51-
connect.host = defaultHost;
52-
} else {
5352
return;
5453
}
5554

src/test/unittest/configuration/providers/djangoLaunch.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ suite('Debugging - Configuration Provider Django', () => {
119119
const workspaceFolderToken = '${workspaceFolder}';
120120
const defaultProgram = `${workspaceFolderToken}-manage.py`;
121121
pathSeparatorStub.value('-');
122-
when(input.showInputBox(anything())).thenResolve();
122+
when(input.showInputBox(anything())).thenResolve(defaultProgram);
123123
await djangoLaunch.buildDjangoLaunchDebugConfiguration(instance(input), state);
124124

125125
const config = {

src/test/unittest/configuration/providers/fastapiLaunch.unit.test.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,6 @@ suite('Debugging - Configuration Provider FastAPI', () => {
4242

4343
expect(file).to.be.equal('main.py');
4444
});
45-
test('Launch JSON with valid python path', async () => {
46-
const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 };
47-
const state = { config: {}, folder };
48-
49-
await fastApiLaunch.buildFastAPILaunchDebugConfiguration(instance(input), state);
50-
51-
const config = {
52-
name: DebugConfigStrings.fastapi.snippet.name,
53-
type: DebuggerTypeName,
54-
request: 'launch',
55-
module: 'uvicorn',
56-
args: ['main:app', '--reload'],
57-
jinja: true,
58-
};
59-
60-
expect(state.config).to.be.deep.equal(config);
61-
});
6245
test('Launch JSON with selected app path', async () => {
6346
const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 };
6447
const state = { config: {}, folder };

src/test/unittest/configuration/providers/flaskLaunch.unit.test.ts

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -41,27 +41,6 @@ suite('Debugging - Configuration Provider Flask', () => {
4141

4242
expect(file).to.be.equal('app.py');
4343
});
44-
test('Launch JSON with valid python path', async () => {
45-
const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 };
46-
const state = { config: {}, folder };
47-
48-
await flaskLaunch.buildFlaskLaunchDebugConfiguration(instance(input), state);
49-
50-
const config = {
51-
name: DebugConfigStrings.flask.snippet.name,
52-
type: DebuggerTypeName,
53-
request: 'launch',
54-
module: 'flask',
55-
env: {
56-
FLASK_APP: 'app.py',
57-
FLASK_DEBUG: '1',
58-
},
59-
args: ['run', '--no-debugger', '--no-reload'],
60-
jinja: true,
61-
};
62-
63-
expect(state.config).to.be.deep.equal(config);
64-
});
6544
test('Launch JSON with selected app path', async () => {
6645
const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 };
6746
const state = { config: {}, folder };
@@ -88,7 +67,7 @@ suite('Debugging - Configuration Provider Flask', () => {
8867
test('Launch JSON with default managepy path', async () => {
8968
const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 };
9069
const state = { config: {}, folder };
91-
when(input.showInputBox(anything())).thenResolve();
70+
when(input.showInputBox(anything())).thenResolve('app.py');
9271

9372
await flaskLaunch.buildFlaskLaunchDebugConfiguration(instance(input), state);
9473

src/test/unittest/configuration/providers/moduleLaunch.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ suite('Debugging - Configuration Provider Module', () => {
1919
const state = { config: {}, folder };
2020
const input = mock<MultiStepInput<DebugConfigurationState>>(MultiStepInput);
2121

22-
when(input.showInputBox(anything())).thenResolve();
22+
when(input.showInputBox(anything())).thenResolve('enter-your-module-name');
2323

2424
await buildModuleLaunchConfiguration(instance(input), state);
2525

src/test/unittest/configuration/providers/pyramidLaunch.unit.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ suite('Debugging - Configuration Provider Pyramid', () => {
9999
const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 };
100100
const state = { config: {}, folder };
101101
pathSeparatorStub.value('-');
102+
when(input.showInputBox(anything())).thenResolve('${workspaceFolder}-development.ini');
102103

103104
await pyramidLaunch.buildPyramidLaunchConfiguration(instance(input), state);
104105

@@ -141,7 +142,7 @@ suite('Debugging - Configuration Provider Pyramid', () => {
141142
const defaultIni = `${workspaceFolderToken}-development.ini`;
142143

143144
pathSeparatorStub.value('-');
144-
when(input.showInputBox(anything())).thenResolve();
145+
when(input.showInputBox(anything())).thenResolve(defaultIni);
145146

146147
await pyramidLaunch.buildPyramidLaunchConfiguration(instance(input), state);
147148

src/test/unittest/configuration/providers/remoteAttach.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ suite('Debugging - Configuration Provider Remote Attach', () => {
6262
const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 };
6363
const state = { config: {}, folder };
6464
let portConfigured = false;
65-
when(input.showInputBox(anything())).thenResolve();
65+
when(input.showInputBox(anything())).thenResolve('localhost');
6666

6767
sinon.stub(configuration, 'configurePort').callsFake(async () => {
6868
portConfigured = true;

0 commit comments

Comments
 (0)