Skip to content

Commit e90cc01

Browse files
test(desktop): cover login-shell Android SDK hydration
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent b6c944c commit e90cc01

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

‎apps/desktop/src/shell/DesktopShellEnvironment.test.ts‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,39 @@ describe("DesktopShellEnvironment", () => {
238238
}),
239239
);
240240

241+
it.effect.each([
242+
{
243+
name: "hydrates both Android SDK names when neither is inherited",
244+
inherited: {},
245+
expected: { ANDROID_HOME: "/shell/android-home", ANDROID_SDK_ROOT: "/shell/android-root" },
246+
},
247+
{
248+
// The device host reads ANDROID_HOME before ANDROID_SDK_ROOT, so a shell
249+
// ANDROID_HOME next to an inherited ANDROID_SDK_ROOT would change the SDK.
250+
name: "keeps an inherited ANDROID_SDK_ROOT selected over a login-shell ANDROID_HOME",
251+
inherited: { ANDROID_SDK_ROOT: "/inherited/android-sdk" },
252+
expected: { ANDROID_HOME: undefined, ANDROID_SDK_ROOT: "/inherited/android-sdk" },
253+
},
254+
])("$name", ({ inherited, expected }) =>
255+
Effect.gen(function* () {
256+
const env: NodeJS.ProcessEnv = { SHELL: "/bin/zsh", PATH: "/usr/bin", ...inherited };
257+
258+
yield* runShellEnvironment({
259+
env,
260+
platform: "darwin",
261+
handler: () =>
262+
envOutput({
263+
PATH: "/usr/bin",
264+
ANDROID_HOME: "/shell/android-home",
265+
ANDROID_SDK_ROOT: "/shell/android-root",
266+
}),
267+
});
268+
269+
assert.equal(env.ANDROID_HOME, expected.ANDROID_HOME);
270+
assert.equal(env.ANDROID_SDK_ROOT, expected.ANDROID_SDK_ROOT);
271+
}),
272+
);
273+
241274
it.effect("keeps mise's PATH record with the login shell PATH", () =>
242275
Effect.gen(function* () {
243276
const env: NodeJS.ProcessEnv = {

0 commit comments

Comments
 (0)