* Test setting defaultShell to /bin/sh
()
| 154 | * Test setting defaultShell to /bin/sh |
| 155 | */ |
| 156 | async function testDefaultShellSh() { |
| 157 | console.log('\nTest 1: Setting defaultShell to /bin/sh'); |
| 158 | |
| 159 | // Check if /bin/sh is available |
| 160 | const isAvailable = await isShellAvailable('/bin/sh'); |
| 161 | if (!isAvailable) { |
| 162 | console.log('⚠️ Skipping /bin/sh test: shell not available on this system'); |
| 163 | return; |
| 164 | } |
| 165 | |
| 166 | // Set defaultShell to /bin/sh |
| 167 | await configManager.setValue('defaultShell', '/bin/sh'); |
| 168 | |
| 169 | // Verify config was set correctly |
| 170 | const config = await configManager.getConfig(); |
| 171 | assert.strictEqual(config.defaultShell, '/bin/sh', 'defaultShell should be set to /bin/sh'); |
| 172 | console.log(`✓ Configuration updated: defaultShell = ${config.defaultShell}`); |
| 173 | |
| 174 | // Execute echo $0 to check the shell |
| 175 | const shellOutput = await getShellFromCommand(config.defaultShell); |
| 176 | console.log(`✓ Command output: ${shellOutput}`); |
| 177 | |
| 178 | // Verify the shell is /bin/sh |
| 179 | const expectedOutputs = getExpectedShellOutput('/bin/sh'); |
| 180 | const isValidOutput = expectedOutputs.includes(shellOutput); |
| 181 | assert(isValidOutput, `Shell should be one of ${expectedOutputs.join(', ')}, got: ${shellOutput}`); |
| 182 | console.log('✓ Test 1 passed: /bin/sh is correctly set as default shell'); |
| 183 | } |
| 184 | |
| 185 | /** |
| 186 | * Test setting defaultShell to bash |
no test coverage detected