TestIsCodespaces tests IsCodespaces function
(t *testing.T)
| 236 | |
| 237 | // TestIsCodespaces tests IsCodespaces function |
| 238 | func TestIsCodespaces(t *testing.T) { |
| 239 | // Test that the function returns a boolean without error |
| 240 | result := nodeps.IsCodespaces() |
| 241 | require.IsType(t, false, result) |
| 242 | |
| 243 | // Test the logic based on current environment |
| 244 | // IsCodespaces should return true only if: |
| 245 | // 1. DDEV_PRETEND_CODESPACES=true (for testing purposes), OR |
| 246 | // 2. Running on Linux AND CODESPACES=true |
| 247 | pretendCodespaces := nodeps.IsEnvTrue("DDEV_PRETEND_CODESPACES") |
| 248 | codespacesEnv := os.Getenv("CODESPACES") == "true" |
| 249 | isLinux := runtime.GOOS == "linux" |
| 250 | |
| 251 | expectedResult := pretendCodespaces || (isLinux && codespacesEnv) |
| 252 | require.Equal(t, expectedResult, result) |
| 253 | } |
| 254 | |
| 255 | // TestGetWSLDistro tests GetWSLDistro function |
| 256 | func TestGetWSLDistro(t *testing.T) { |
nothing calls this directly
no test coverage detected