|
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 |
|
17 | | -import { debugConfigurationFactory } from '../debug-configuration.factory'; |
| 17 | +import { gdbTargetConfiguration, targetConfigurationFactory } from '../debug-configuration.factory'; |
18 | 18 | import { JlinkConfigurationProvider } from './jlink-configuration-provider'; |
19 | 19 |
|
20 | 20 | describe('JlinkConfigurationProvider', () => { |
21 | 21 |
|
22 | | - it('resolveDebugConfigurationWithSubstitutedVariables', async () => { |
23 | | - const configProvider = new JlinkConfigurationProvider(); |
24 | | - const config = debugConfigurationFactory(); |
25 | | - const debugConfig = await configProvider.resolveDebugConfigurationWithSubstitutedVariables(undefined, config, undefined); |
26 | | - expect(debugConfig).toBeDefined(); |
| 22 | + describe('resolveDebugConfigurationWithSubstitutedVariables', () => { |
| 23 | + |
| 24 | + it('does not add undefined server parameters', async () => { |
| 25 | + const configProvider = new JlinkConfigurationProvider(); |
| 26 | + const config = gdbTargetConfiguration({ |
| 27 | + target: targetConfigurationFactory(), |
| 28 | + }); |
| 29 | + const debugConfig = await configProvider.resolveDebugConfigurationWithSubstitutedVariables(undefined, config, undefined); |
| 30 | + expect(debugConfig).toBeDefined(); |
| 31 | + expect(debugConfig?.target?.serverParameters).not.toContain('-port'); |
| 32 | + }); |
| 33 | + |
| 34 | + it('adds port to server parameters', async () => { |
| 35 | + const configProvider = new JlinkConfigurationProvider(); |
| 36 | + const config = gdbTargetConfiguration({ |
| 37 | + target: targetConfigurationFactory({ port: '4711' }), |
| 38 | + }); |
| 39 | + const debugConfig = await configProvider.resolveDebugConfigurationWithSubstitutedVariables(undefined, config, undefined); |
| 40 | + expect(debugConfig).toBeDefined(); |
| 41 | + expect(debugConfig?.target?.serverParameters).toContain('-port'); |
| 42 | + expect(debugConfig?.target?.serverParameters).toContain('4711'); |
| 43 | + }); |
| 44 | + |
| 45 | + it('does not overwrite port in server parameters', async () => { |
| 46 | + const configProvider = new JlinkConfigurationProvider(); |
| 47 | + const config = gdbTargetConfiguration({ |
| 48 | + target: targetConfigurationFactory({ |
| 49 | + port: '4711', |
| 50 | + serverParameters: ['-port', '10815'], |
| 51 | + }), |
| 52 | + }); |
| 53 | + const debugConfig = await configProvider.resolveDebugConfigurationWithSubstitutedVariables(undefined, config, undefined); |
| 54 | + expect(debugConfig).toBeDefined(); |
| 55 | + expect(debugConfig?.target?.serverParameters).toContain('-port'); |
| 56 | + expect(debugConfig?.target?.serverParameters).toContain('10815'); |
| 57 | + }); |
| 58 | + |
27 | 59 | }); |
28 | 60 |
|
29 | 61 | }); |
0 commit comments