* Test that configuration changes persist
()
| 332 | * Test that configuration changes persist |
| 333 | */ |
| 334 | async 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 |
no test coverage detected