fix(ioscompanion): reinstall via simctl and sanitize companion env

This commit is contained in:
pj committed 2026-06-06 23:56:08 +05:30
1 parent 5ab2991dd0
commit 93b62d4aa5
2 files changed
+34 -6

No files matched your search

+7 -4
View File
@@ -108,6 +108,7 @@ func newTestDriver(companion transport.Companion) *Driver {
screenHeight: 844,
}
d.resetContainer = func(context.Context) error { return nil }
d.reinstallApp = func(context.Context) error { return nil }
return d
}
@@ -140,14 +141,16 @@ func TestLaunchClearStateReinstallsWithAppPath(t *testing.T) {
companion := &fakeCompanion{accessibilityJSON: "[]"}
d := newTestDriver(companion)
d.appPath = "/tmp/Sample.app"
reinstalls := 0
d.reinstallApp = func(context.Context) error { reinstalls++; return nil }
if err := d.Launch(context.Background(), "", true, nil); err != nil {
t.Fatalf("Launch: %v", err)
}
if indexOf(companion.calls, "uninstall") < 0 || indexOf(companion.calls, "install") < 0 {
t.Fatalf("clear-state with app path must uninstall then install; got %v", companion.calls)
if reinstalls != 1 {
t.Fatalf("clear-state with app path must reinstall exactly once; got %d", reinstalls)
}
if indexOf(companion.calls, "uninstall") > indexOf(companion.calls, "install") {
t.Fatalf("uninstall must precede install; got %v", companion.calls)
if indexOf(companion.calls, "launch") < indexOf(companion.calls, "terminate") {
t.Fatalf("launch must still follow terminate; got %v", companion.calls)
}
}