mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-04 20:17:09 +00:00
fix(sidecar): default reinstallApp in SetClearStateReinstall; cover non-android clear
Only Dial set reinstallApp, so a Client built another way would nil-deref on Android clear-state. Default it in SetClearStateReinstall too. Add a non-android test so the platform guard has negative coverage: dropping the android check would now fail.
This commit is contained in:
1 parent
4c931635d7
commit
b7d624662b
2 files changed
+22
No files matched your search
@@ -372,6 +372,25 @@ func TestClient_LaunchClearStateWithoutApkPathUsesSidecarClear(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestClient_LaunchClearStateNonAndroidUsesSidecarClear(t *testing.T) {
|
||||
state := newHarness(t)
|
||||
client, _ := Dial(state.address)
|
||||
defer client.Close()
|
||||
client.SetPlatform("ios")
|
||||
client.SetClearStateReinstall("", "/tmp/app.app", io.Discard)
|
||||
client.reinstallApp = func(_ context.Context, _, _, _ string, _ io.Writer) error {
|
||||
t.Fatal("reinstall must not run on a non-android platform")
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := client.Launch(context.Background(), "app.folio", true, nil); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !state.fake.clearState {
|
||||
t.Error("non-android clear-state must forward clearState to the sidecar")
|
||||
}
|
||||
}
|
||||
|
||||
func TestClient_TapAndTapSelector(t *testing.T) {
|
||||
state := newHarness(t)
|
||||
client, _ := Dial(state.address)
|
||||
|
||||
Reference in new issue
Block a user