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

Function testConfigurationPersistence

test/test-default-shell.js:334–365  ·  view source on GitHub ↗

* Test that configuration changes persist

()

Source from the content-addressed store, hash-verified

332 * Test that configuration changes persist
333 */
334async function testConfigurationPersistence() {
335 console.log('\nTest 6: Testing configuration persistence');
336
337 // Find an available shell for testing
338 let testShell = '/bin/sh';
339 if (!(await isShellAvailable('/bin/sh'))) {
340 if (await isShellAvailable('/bin/bash')) {
341 testShell = '/bin/bash';
342 } else if (await isShellAvailable('cmd')) {
343 testShell = 'cmd';
344 } else if (await isShellAvailable('pwsh')) {
345 testShell = 'pwsh';
346 } else {
347 console.log('⚠️ Skipping persistence test: no available shells found');
348 return;
349 }
350 }
351
352 // Set defaultShell to the test shell
353 await configManager.setValue('defaultShell', testShell);
354
355 // Get config multiple times to ensure it persists
356 const config1 = await configManager.getConfig();
357 const config2 = await configManager.getConfig();
358
359 assert.strictEqual(config1.defaultShell, testShell, 'Configuration should persist on first read');
360 assert.strictEqual(config2.defaultShell, testShell, 'Configuration should persist on second read');
361 assert.strictEqual(config1.defaultShell, config2.defaultShell, 'Configuration should be consistent across reads');
362
363 console.log(`✓ Configuration persists correctly: ${config1.defaultShell}`);
364 console.log('✓ Test 6 passed: configuration persistence works correctly');
365}
366
367/**
368 * Main test function

Callers 1

runDefaultShellTestsFunction · 0.85

Calls 4

isShellAvailableFunction · 0.85
logMethod · 0.80
setValueMethod · 0.80
getConfigMethod · 0.80

Tested by

no test coverage detected