MCPcopy Create free account
hub / github.com/wonderwhy-er/DesktopCommanderMCP / testDefaultShellPwsh

Function testDefaultShellPwsh

test/test-default-shell.js:252–279  ·  view source on GitHub ↗

* Test setting defaultShell to pwsh (PowerShell Core)

()

Source from the content-addressed store, hash-verified

250 * Test setting defaultShell to pwsh (PowerShell Core)
251 */
252async function testDefaultShellPwsh() {
253 console.log('\nTest 4: Setting defaultShell to pwsh');
254
255 // Check if pwsh is available
256 const isAvailable = await isShellAvailable('pwsh');
257 if (!isAvailable) {
258 console.log('⚠️ Skipping pwsh test: PowerShell Core not available on this system');
259 return;
260 }
261
262 // Set defaultShell to pwsh
263 await configManager.setValue('defaultShell', 'pwsh');
264
265 // Verify config was set correctly
266 const config = await configManager.getConfig();
267 assert.strictEqual(config.defaultShell, 'pwsh', 'defaultShell should be set to pwsh');
268 console.log(`✓ Configuration updated: defaultShell = ${config.defaultShell}`);
269
270 // Execute PowerShell command to check the shell
271 const shellOutput = await getShellFromCommand('pwsh');
272 console.log(`✓ Command output: ${shellOutput}`);
273
274 // Verify the shell is pwsh
275 const expectedOutputs = getExpectedShellOutput('pwsh');
276 const isValidOutput = expectedOutputs.includes(shellOutput);
277 assert(isValidOutput, `Shell should be one of ${expectedOutputs.join(', ')}, got: ${shellOutput}`);
278 console.log('✓ Test 4 passed: pwsh is correctly set as default shell');
279}
280/**
281 * Test switching between different shells
282 */

Callers 1

runDefaultShellTestsFunction · 0.85

Calls 7

isShellAvailableFunction · 0.85
getShellFromCommandFunction · 0.85
getExpectedShellOutputFunction · 0.85
logMethod · 0.80
setValueMethod · 0.80
getConfigMethod · 0.80
assertFunction · 0.70

Tested by

no test coverage detected