(t *testing.T)
| 91 | } |
| 92 | |
| 93 | func TestNewRemoteRootModel_DownloadRequestUsesServiceAdd(t *testing.T) { |
| 94 | service := &fakeRemoteDownloadService{} |
| 95 | m := newRemoteRootModel("https://example.com:1700", service) |
| 96 | m.Settings.Extension.ExtensionPrompt.Value = false |
| 97 | m.Settings.General.WarnOnDuplicate.Value = false |
| 98 | |
| 99 | updated, cmd := m.Update(events.DownloadRequestMsg{ |
| 100 | URL: "https://example.com/file.bin", |
| 101 | Filename: "file.bin", |
| 102 | Path: ".", |
| 103 | }) |
| 104 | if cmd != nil { |
| 105 | t.Fatal("expected remote add path to complete synchronously without orchestration cmd") |
| 106 | } |
| 107 | |
| 108 | root, ok := updated.(tui.RootModel) |
| 109 | if !ok { |
| 110 | t.Fatalf("unexpected updated model type %T", updated) |
| 111 | } |
| 112 | if service.addCalls != 1 { |
| 113 | t.Fatalf("expected service.Add to be called once, got %d", service.addCalls) |
| 114 | } |
| 115 | if service.lastURL != "https://example.com/file.bin" { |
| 116 | t.Fatalf("service URL = %q, want request URL", service.lastURL) |
| 117 | } |
| 118 | if service.lastFile != "file.bin" { |
| 119 | t.Fatalf("service filename = %q, want file.bin", service.lastFile) |
| 120 | } |
| 121 | selected := root.GetSelectedDownload() |
| 122 | if selected == nil { |
| 123 | t.Fatal("expected queued remote download to be selected") |
| 124 | return |
| 125 | } |
| 126 | if selected.ID != "remote-add-id" { |
| 127 | t.Fatalf("queued download ID = %q, want remote-add-id", selected.ID) |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | func TestParseConnectTarget_ParsesIPv6AddressWithPort(t *testing.T) { |
| 132 | tests := []struct { |
nothing calls this directly
no test coverage detected